Ale*_* Le 7 typescript next.js
我正在将现有的 NextJS 项目迁移到 TypeScript,大多数事情似乎都运行良好。我 npm 安装了建议的类型文件,NextJStsconfig.json为我生成了一个默认文件,我能够将我的文件转换为 .tsx 文件,并且我看到正常的 TypeScript 行为,例如智能感知和悬停查看详细信息。
但是,我将“严格”从false翻转为true,并且根本没有收到任何错误。例如,隐式“anys”根本不加下划线。
这是默认的 tsconfig,其中“strict”属性被翻转。
{
"compilerOptions": {
"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"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
814 次 |
| 最近记录: |