[Solved] TS2307: Cannot find module ‘./style.module.scss’ or its corresponding type declarations.

react write ts script import module error:

import style from './style.module.scss' reports an 
error: TS2307: Cannot find module './style.module.scss' or its corresponding type declarations. 

It is because there is no relevant declaration in react-app-env.d.ts added in
declare module '*.module.scss' { 
    const classes: { readonly [key: string]: string } 
    export default classes 
} 

Saving can solve the problem

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *