Closed muuvmuuv closed 10 months ago
Your current setup works. It's just that typescript doesn't understand that .json does not mean json. You might want to raise it with TS folks!
Is that really a TS issue? From what I see TS gets the path correct (second error), just has issue with ./*
. Maybe a explicit ./*.json
would help. In general that shouldn't be a problem since Angular e.g. uses xxx.component.ts
where component
is the same as json
here.
The second error is how things are supposed to work. Because the second code is not allowed. See the docs or the export map in package.json for what is allowed.
The first code is allowed. But TS fails. Other tools don’t fail. Here TS fails too: https://github.com/wooorm/starry-night/blob/98556ed2274d13fbc10925e4a9b084a47ee62d8d/lib/all.js#L815-L816.
If you use other tools that fail, that might be in those tools too. But you never said which tools you use, so I can’t debug something I don’t know.
Yes, the second was just a try to fix the conflict.
I use VS Code, my project is an Angular app. Here is a repl (didn't had time yet): https://codesandbox.io/p/sandbox/elegant-surf-dft8c3?file=%2Fsrc%2Fapp%2Fapp.component.ts%3A12%2C3-12%2C13
Add a // @ts-expect-error
above it and it works?
Again, TS just doesn’t get .json
in export maps.
Works! Hm, is this special to .json? Because other potential extensions seems to work. Anyway worth to add to the docs I think.
Yes, TS has a bug with .json
. See the code I linked before:
It’s something TS should solve.
There is no export at the root of starry-night:
show this error:
but in /lang/ are all grammars exported. Unfortunately when using lang I get this error: