There are many challenges when trying to adopt TypeScript into your JavaScript project. Your project may already have tons of untyped files, changing your build system can sound risky, and your colleages may ask if the cost of investing in migrating all the code to TypeScript would be worth the effort or not.
Some may argue that they wouldn’t need types because they already have tests. Some may question whether the benefit would really outweigh the TypeScript tax. Some may have had bad experience with earlier versions of TypeScript before. And there are many outdated opinion pieces everywhere.
But adopting TypeScript doesn’t have to be a big, all-or-none effort.
There are strategies for incrementally introducing pieces and bits of TypeScript into your JavaScript project, each little step immediately improving the developer experience, without having to install extra dependencies or make any changes to the build system.
This is what I discuss about in this talk. It also contains real-world examples which is kinda hard to convey just in text.
Topics discussed
jsconfig.json
for improved code actions and automatic refactoring.// @ts-check
to type-check JavaScript files (with examples on dealing with a few type-checking errors).checkJs
to type-check JavaScript files project-wide..d.ts
file next to a JavaScript file to keep the .js
file unmodified..d.ts
file to declare modules and global variables.
Note: The talk is in Thai language but I added English captions, and all slides are in English.
Hope you find it useful, and thanks for watching! Also, please consider subscribing to my YouTube channel for more content.
Top comments (0)