问题
I'm using TypeScript version 1.8.10 in Visual Studio 2015.
In tsconfig.json I have those settings as
"compilerOptions": {
"target": "es6",
"module": "system",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": true,
"noImplicitAny": true,
"noEmitOnError": false,
"noImplicitUseStrict": false,
"declaration": false,
"inlineSourceMap": true,
"inlineSources": true
},
I'm wondering is is there a setting that disallow the use of "any" and force us to use datatype such as number, string, etc. instead of "any"?
回答1:
You could use TSlint in conjunction with TypeScript and set the no-any
flag. See https://www.npmjs.com/package/tslint (search for no-any)
来源:https://stackoverflow.com/questions/36898828/does-typescript-have-an-option-to-disallow-any-when-declaring-or-cast-conversi