【发布时间】:2021-03-21 09:36:09
【问题描述】:
我使用 react admin 和 typescript。
我更喜欢使用strict 类型检查。所以当我运行tsc 时,react admin 向我显示了一个implicitly any 错误。
尽管我使用了"skipLibCheck": true,但错误来了。我该如何解决?
node_modules/ra-core/src/auth/useCheckAuth.ts:101:26 - error TS7006: Parameter 'error' implicitly has an 'any' type.
101 const getErrorMessage = (error, defaultMessage) =>
~~~~~
下面是我的 tsconfig 文件。
{
"compilerOptions": {
"baseUrl": ".",
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"paths": {
"@components/*": ["components/*"],
"@styles/*": ["styles/*"],
"@lib/*": ["lib/*"],
"@pages/*": ["pages/*"]
}
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}
【问题讨论】:
标签: reactjs typescript node-modules react-admin tsc