#TypeScript 6.0 CSS import issues

6 messages · Page 1 of 1 (latest)

dense karma
#

I am getting this error when trying to import CSS:

src/components/Ketcher/KetcherDialog.tsx:1:8 - error TS2882: Cannot find module or type declarations for side-effect import of 'ketcher-react/dist/index.css'.

1 import "ketcher-react/dist/index.css";
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This only started happening when I upgrade to TS 6.0. I would like to align with 7.0 defaults if possible, and adding ketcher-react to compilerOptions.types doesn't silence the error. What is the solution here?

dense summit
#

either declare that these imports work via declare module "*.css" (vite prepopulates this for you!), or set noUncheckedSideEffectImports: false

dense karma
karmic knoll
#

I think there's a webpack-env entry you can add to your types array

#

... but then I don't remember if it actually includes stuff like css types.