[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

 

posted @ 2022-08-29 18:49  Zhentiw  阅读(18)  评论(0编辑  收藏  举报