Stage 1 · Lesson 3 of 10
TypeScript types and strict mode
adds static types to . You say what kind of value each thing holds, and TypeScript checks it before the code runs. Learn the basic types first: strings, numbers and booleans.
Then learn interfaces and type aliases, which describe the shape of an object. Union types list the allowed values, such as 'admin' | 'member'. Also learn optional fields and like Promise<User>, which is a that will hold a User.
Narrowing with typeof and in lets TypeScript work out which type you have. Turn on strict in tsconfig.json from the first file, so null and undefined must be handled on purpose. Types make changes safer and editors more helpful, which matters more as a service grows.
Common trapbelieving types protect you while the program runs. They are erased when the code is compiled, so a request body typed as User is still unchecked JSON. It stays unchecked until you validate it, which you will do with a library in the API stage.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with· follow one of these
- CoursePaidGrokking JavaScript Fundamentals
Design Gurus · Beginner · $50
JavaScript itself in a sensible order: scope, closures, promises and async code
- GuideFreeNode.js Learn
OpenJS Foundation · Beginner
Official guides on the event loop, async work, the http module and environment variables
Practise
Keep handy
Also worth your time
The DNS, TCP, TLS and HTTP steps behind every request your backend will handle