freeCodeCamp.org on YouTube · Open on YouTube
Core skills: building for the web · Advanced beginner · Lesson 19 of 98 · 1 h 1 min video, then about 1 week of practice
TypeScript: types as documentation and a safety net
After this you can type functions, objects and API responses in TypeScript and read the compiler's errors.
Why it matters
TypeScript is now the default for professional JavaScript work. Types catch a large class of bugs before you run the code, and more importantly they document what a function expects and returns, which matters enormously once other people read your code. Focus on the basics that pay off immediately: annotating function parameters and return types, object types and interfaces, union types, and narrowing. Turn on `strict` mode from the start. Trap: sprinkling `any` to make errors go away. Every `any` is a hole in the net.
How to use this resource
An hour-long crash course that covers what you need for application code.
Go further
Go deeper