TS2307: Cannot find module './style.module.scss' or its corresponding type declarations.
react 在写ts脚本时,导入的模块
import style from './style.module.scss'
报错:TS2307: Cannot find module './style.module.scss' or its corresponding type declarations.
是因为没有进行相关声明 在react-app-env.d.ts中添加
declare module '*.module.scss' {
const classes: { readonly [key: string]: string }
export default classes
}
保存 既可以解决问题