[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 @   Zhentiw  阅读(19)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
历史上的今天:
2019-08-29 [React + GraphQL] Use useLazyQuery to manually execute a query with Apollo React Hooks
2019-08-29 [CSS] Conditionally Assign Style to a Parent Element with Focus-Within Pseudo-class
2019-08-29 [Angular 8] Calculate and Measure Performance budgets with the Angular CLI
2019-08-29 [Angular 8] Custom Route Preloading with ngx-quicklink and Angular
2019-08-29 [Angular 8] Implement a Custom Preloading Strategy with Angular
2019-08-29 [Angular 8] Lazy loading with dynamic loading syntax
2018-08-29 [React] Prevent Unnecessary Rerenders of Compound Components using React Context
点击右上角即可分享
微信分享提示