question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can I use use highlight.js in TS without all the languages?

See original GitHub issue

I read in the README about importing import * as hljs from 'highlight.js/lib/highlight.js'; instead of the index but this does not have types. Anyone know how I can get types for the file instead of the module?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
rtfpessoacommented, Jan 2, 2020

Thanks for the help here I opened an issue in DefinitelyTypedto follow with the discussion.

2reactions
joshgoebelcommented, Mar 10, 2020

Yeah, there is an open PR to change the readme to add the new package location. I just published the beta to it’s new location today and we’re still trying to sort out the proper transition. I think now that we’ve published it to both places we may have made things more difficult, but I’ve reached out to NPM support for help to see about the best path forward.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Load only highlight.js library using TypeScript, not default with ...
I solved this problem by creating a Javascript file that requires only the languages I need: myhighlight.js var hljs = require('../../.
Read more >
How to use highlight.js
Highlight.js supports over 180 languages in the core library. There are also 3rd party language definitions available to support even more languages. You...
Read more >
Highlight.js requires Typescript users to set `esModuleInterop ...
To use highlight.js without typescript complaining, I need to do: ... import * as hljs from 'highlight.js` // @ts-ignore-error ...
Read more >
Language Definition Guide — highlight.js 11.7.0 documentation
Highlight.js tries to automatically detect the language of a code fragment. The heuristics is essentially simple: it tries to highlight a fragment with...
Read more >
Speed-highlight JS - Deno
Name Class name Language detection bash shj‑lang‑bash ✓ brainfuck shj‑lang‑bf ❌ css shj‑lang‑css ✓
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found