我遇到了这个问题,我想关闭严格模式来解决它。
我已经修改了tsconfig.json
文件:
"compilerOptions": {
"strict": false,
同时还尝试过:
"compilerOptions": {
"noImplicitUseStrict": true,
但是没有爱。有何想法?
我遇到了这个问题,我想关闭严格模式来解决它。
我已经修改了tsconfig.json
文件:
"compilerOptions": {
"strict": false,
同时还尝试过:
"compilerOptions": {
"noImplicitUseStrict": true,
但是没有爱。有何想法?
根据Angular文档,可以通过在tsconfig.json文件中关闭以下标志来禁用严格模式:
"forceConsistentCasingInFileNames": false,
"strict": false,
"noImplicitReturns": false,
"noFallthroughCasesInSwitch": false,
...
"angularCompilerOptions": {
"strictInjectionParameters": false,
"strictInputAccessModifiers": false,
"strictTemplates": false
}
"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"
]
}
关于 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
}
}
}
}
}
--strict
选项将其设置为 false,以创建一个没有启用严格模式的新 Angular 项目。
ng new app --strict=false
这将导致 tsconfig.json 中没有 strict...
选项。从tsconfig.json中删除"strict": true
arguments.callee.name
并不是什么大问题,你只需要注意边缘情况即可。 - Ole