Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disallow implicit any?

I am using TSLint with "no-any": true, "no-unsafe-any": true. It disallow:

let foo: any;

However it still allows:

let foo;

How to turn on the rule for implicit any?

like image 470
SwiftMango Avatar asked Nov 17 '17 05:11

SwiftMango


People also ask

How do I turn on noImplicitAny?

You can stop this behavior by enabling the compiler flag noImplicitAny . To enable open the tsconfig file and add the "noImplicitAny":true under the compilerOptions .

What is a Tsconfig file?

The tsconfig.json file specifies the root files and the compiler options required to compile the project. JavaScript projects can use a jsconfig.json file instead, which acts almost the same but has some JavaScript-related compiler flags enabled by default.

What is allowJs Tsconfig?

allowJs is the option newly available in 1.8. The TypeScript compiler will run a quick sanity check on . js files for syntax errors but otherwise passes them straight through to the output directory.


1 Answers

As of now there is no option in tslint to achieve that. You could use the typescript compiler option "noImplicitAny": true, which can be configured using tsconfig.json.

Reference : https://www.typescriptlang.org/docs/handbook/compiler-options.html

like image 110
Dhana Sekar Avatar answered Sep 21 '22 06:09

Dhana Sekar