20 TypeScript Compiler Options for your TSCONFIG.JSON

Опубликовано: 22 Октябрь 2024
на канале: Lucas Paganini
17,356
298

Using TypeScript with the default options makes your code a lot safer than JavaScript, but did you know that the type safety can be improved?

That's why I recorded a video this video showing the 20 TypeScript flags that me and my team use and you should set in your "tsconfig.json" too!

📚 Read the article: https://www.lucaspaganini.com/academy...
🚨 Subscribe to the newsletter: https://www.lucaspaganini.com/newsletter

📧 Email: [email protected]
🐦 Twitter:   / lucaspaganini  
📸 Instagram:   / lucaspaganini  

----------

CHAPTERS
00:00 Short Version
00:18 Introduction
01:05 Dealing with the Errors
02:05 Our Compiler Options Recommendation
02:33 Staying Updated
02:58 Strict Mode Flags
03:05 strict
03:31 alwaysStrict
04:24 noImplicitAny
06:21 noImplicitThis
07:02 strictNullChecks
07:47 strictBindCallApply
08:05 strictFunctionTypes
10:43 strictPropertyInitialization
11:16 useUnknownInCatchVariables
12:21 No Unused Code
12:32 noUnusedLocals
12:49 noUnusedParameters
13:15 allowUnusedLabels = false
13:56 allowUnreachableCode = false
14:17 No Implicit Code
14:29 noImplicitOverride
15:29 noImplicitReturns
16:28 Others
16:37 noUncheckedIndexedAccess
17:26 noPropertyAccessFromIndexSignature
17:55 noFallthroughCasesInSwitch
19:05 forceConsistentCasingInFileNames
19:25 exactOptionalPropertyTypes
21:00 Conclusion

REFERENCES
1. TypeScript Strict Flag - (TypeScript Documentation): https://www.typescriptlang.org/tsconf...
2. TypeScript CLI Compiler Options - (TypeScript Documentation): https://www.typescriptlang.org/docs/h...
3. JavaScript Strict Mode - (Mozilla Developer Network): https://developer.mozilla.org/en-US/d...
4. ECMAScript Strict Mode Specification - (ECMAScript Specification): https://tc39.es/ecma262/#sec-strict-m...
5. How TypeScript’s Strict Mode Actually Fixes TypeScript - (Eran Shabi (@eranshabi on Twitter)): https://betterprogramming.pub/how-typ...
6. Why are function parameters bivariant in TypeScript? - (TypeScript Official FAQ): https://github.com/Microsoft/TypeScri...
7. Cheat Codes for Contravariance and Covariance - (Matt Handler at Originate (@matthandlersux and @weareoriginate on Twitter)): https://www.originate.com/thinking/ch...
8. Covariance vs Contravariance in Programming Languages - (Code Radiance):    • Covariance vs Contravariance in Progr...  
9. JavaScript Paradigms - (Mozilla Developer Network): https://developer.mozilla.org/en-US/d...
10. JavaScript Labels - (Mozilla Developer Network): https://developer.mozilla.org/en-US/d...
11. `override` and the `--noImplicitOverride` Flag - (TypeScript 4.3 Release Notes): https://www.typescriptlang.org/docs/h...
12. JavaScript Property Accessors - Dot and Bracket Notations - (Mozilla Developer Network): https://developer.mozilla.org/en-US/d...
13. JavaScript Switch - (Mozilla Developer Network): https://developer.mozilla.org/en-US/d...

#typescript #webdevelopment #javascript