-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.d.ts needs updating for version 11 #3722
Comments
Break how? How are you using the library? CJS? ES? Browser/Node?
This is definitely not intended, this only exists to make some bundlers happy with how we export things.
That is for version 9, so it's very incorrect and outdated now. |
My code is a VS Code extension which makes the answer to your second question "node". It breaks in the sense that VS Code says the As soon as I revert to 10.7.3 everything is good - although it hasn't been updated since 9.x those typings work fine for both vscode and webpack. |
And how exactly are you importing the library?
We export Our types file exports import hljs from 'highlight.js';
hljs.getLanguages() // etc This certainly works (in practice) with just pulling in the library directly with Node. As far as why VS Code or TypeScript might dislike that I dunno - we really could use a Typescript expert to help us with such matters... |
Yep did as I said and while you were writing my autoimporter (code tool) figured out This is what webpack reports:
|
What style are you trying to import exactly? |
All the light ones. I let users pick at runtime and my embedded webserver serves by name out of the bundle. I don't let them pick dark themes because users don't seem to understand that it doesn't matter what they do on-screen, paper continues to be white. switch (urlParts[3]) {
case "colour-scheme.css":
let colourScheme = vscode.workspace.getConfiguration("print").colourScheme;
let colourSchemeName: string = filenameByCaption[colourScheme];
logger.debug(`Loading colour scheme from ${colourSchemeName}`);
let colourSchemeCss: string = require(`highlight.js/styles/${colourSchemeName}.css`).default.toString();
response.writeHead(200, {
"Content-Type": "text/css; charset=utf-8",
"Content-Length": colourSchemeCss.length,
'Cache-Control': 'no-cache'
});
response.end(colourSchemeCss);
break; |
So the import works now? Great! The styles issues is a dup of #3634... which I've closed - you'll need to take the issue up with Webpack. |
blergh... guess I'll stick with 10.7.3 |
Updating to 11.* causes code like this to break. Revert to 10.7.3 and the weirdness stops.
Adding
.default
helpsbut then there is a new problem reported
Revert to 10.7.3 and the weirdness stops.
I had a look at
.d.ts
definition at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/highlightjs/index.d.ts but the problem wasn't evident.The text was updated successfully, but these errors were encountered: