Skip to content

No error for non-existing css side effect import with noUncheckedSideEffectImports flag onΒ #59990

Closed
@dimafirsov

Description

@dimafirsov

πŸ”Ž Search Terms

noUncheckedSideEffectImports

πŸ•— Version & Regression Information

⏯ Playground Link

https://stackblitz.com/edit/vitejs-vite-v2boec?file=src%2Fmain.ts

πŸ’» Code

import 'does-not-exist.css';

πŸ™ 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 executing tsc. Actually, it is not thrown for any file extension other than js.

πŸ™‚ 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:

  1. Visit the playgound typescript project
  2. Expect the runtime error (because of the non-existing file reference in the code)
  3. main.ts - notice the side effect import of non-existing CSS file
  4. globals.d.ts - notice the file and its contents (as described HERE)
  5. Open new stackblitz terminal
  6. Execute the following: npm run check
  7. Observe a result

Expected result: tsc throws an error for the non-existing file reference

Actual result: Specifically, the tsc successfully finishes with no errors. In general, tsc doesn't throw no matter the file extension, EXCEPT for the .js

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions