其他分享
首页 > 其他分享> > [Typescript] Step 3. Turn on "noImplicitAny" and even more strict mode

[Typescript] Step 3. Turn on "noImplicitAny" and even more strict mode

作者:互联网

Step 3: Turn on "noImplicitAny"

From previous steps, we allow implicit any: https://www.cnblogs.com/Answer1215/p/16634618.html

 

Now, we need to turn on "noImplicitAny" mode.

tsconfig.json

"noImplicitAny": true,

 

Example commit: https://github.com/zhentian-wan/professional-ts/commit/ebc235ebe63a5ce78e526d6d8f0ad75f50a61f02

 

Step 3.1: Turn on "strict: true"

tsconfig.json

"strict": true /* Enable all strict type-checking options. */,

You can try to run tsc command, to see whether there is any build error, if it is then fix it, if not, then continue

 

Step 3.2: Turn on other "strict" settings

tsconfig.json

    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": true,
    "stripInternal": true,
    "forceConsistentCasingInFileNames": true

 

标签:even,Typescript,Turn,noImplicitAny,json,strict,Step,true
来源: https://www.cnblogs.com/Answer1215/p/16634320.html