我已经配置了tsconfig.json,为啥还会报错啊?本地服务起来样式都是正常显示的。
tsconfig.json
{
"compilerOptions": {
"typeRoots": ["./node_modules/@types/", "./src/typings/"]
}
}
typings/global.d.ts
declare module '*.css' {
const content: { [className: string]: string };
export default content;
}
找到问题所在了,我在global.d.ts中进行了export,导致ts把它识别为了module,而module中的
declare module
会失效。