-
Notifications
You must be signed in to change notification settings - Fork 12.8k
No error for non-existing css side effect import with noUncheckedSideEffectImports
flag on
#59990
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
Comments
You cannot benefit from
Mention to If you want to utilize |
Thank you for your response and for the alternative options you gave that may make things work. However though, it is either a confusing wording in release announcement, or it is indeed an issue. The release announcement for this section literally reads like this:
A bit below we can read this:
Not a word about the flag not supporting errors for |
Another thing to add to the conversation here is the name of the flag ( |
I don't really understand what you're proposing happen here. There still needs to be a mechanism to tell TypeScript about modules which will successfully resolve but aren't on disk. That mechanism is |
Thanks @RyanCavanaugh for joining the discussion. Ok, it'll put it in other words. My recent testing has shown that the following side effect imports (and their variations) are well-treated by typescript and it throws an expected error (with the compiler flag on, of course):
However, once there is
I wonder why ts reacts to the Having |
I can't reproduce what you're reporting there.
Maybe you have a |
Good point @RyanCavanaugh , I think I know what's going on there. Even though the environment for the reproduction I gave was clean, it was, apparently, built by Vite. And Vite does this: And a lot more. So, thank you @uhyo and @RyanCavanaugh for your input, and I'm sorry for the false alarm. Closing this one. |
Not an issue. Works as expected. |
Uh oh!
There was an error while loading. Please reload this page.
π Search Terms
noUncheckedSideEffectImports
π Version & Regression Information
β― Playground Link
https://stackblitz.com/edit/vitejs-vite-v2boec?file=src%2Fmain.ts
π» Code
π Actual behavior
With the
noUncheckedSideEffectImports
ts compiler flag on, the error is not thrown for the non-existing.css
file reference (side effect import) when executingtsc
. Actually, it is not thrown for any file extension other thanjs
.π Expected behavior
As stated here, the error should be thrown for non-existing
css
file/module reference.Additional information about the issue
Steps to reproduce:
main.ts
- notice the side effect import of non-existing CSS fileglobals.d.ts
- notice the file and its contents (as described HERE)npm run check
Expected result:
tsc
throws an error for the non-existing file referenceActual result: Specifically, the
tsc
successfully finishes with no errors. In general,tsc
doesn't throw no matter the file extension, EXCEPT for the.js
The text was updated successfully, but these errors were encountered: