Ole*_*Ole 15 javascript node.js typescript webpack angular
我遇到了这个问题,我想关闭严格模式来解决它。
我修改tsconfig.json了:
"compilerOptions": {
"strict": false,
Run Code Online (Sandbox Code Playgroud)
还尝试过:
"compilerOptions": {
"noImplicitUseStrict": true,
Run Code Online (Sandbox Code Playgroud)
但是没有爱。想法?
小智 15
在Angular doc 之后,可以通过关闭tsconfig.json文件上的这些标志来禁用严格模式:
"forceConsistentCasingInFileNames": false,
"strict": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,
...
"angularCompilerOptions": {
"strictInjectionParameters": false,
"strictInputAccessModifiers": false,
"strictTemplates": false
}
Run Code Online (Sandbox Code Playgroud)
如果有人遇到这个问题,我在从 Angular 8 升级到 Angular 10 后遇到了类似的问题。我必须删除所有 Angular 编译器标志,并使用以下 TS 标志:
在 tsconfig.json 上:
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"experimentalDecorators": true,
"module": "es2020",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"noImplicitUseStrict": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
]
}
Run Code Online (Sandbox Code Playgroud)
在 angular.json 上
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my-project-name": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": false
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19038 次 |
| 最近记录: |