TypeScript Crash Course for Beginners (11 Min + Real App)
CheatCoders
0:00 / 0:00
TypeScript Crash Course for Beginners (11 Min + Real App)
22 просмотра · 2 дн. назад
CheatCoders
28 подписчиков
22 просмотра · 2 дн. назад
TypeScript tutorial for JavaScript developers: a TypeScript crash course in about 11 minutes, from basic types to generics, utility types, strict mode and a small real app. Every example is compiled with the real TypeScript compiler (tsc 5.9) and run on Node.js 22, and every error on screen is a real compiler error.
What you'll learn:
Basic types, type inference and typed functions
TypeScript interface vs type alias
Union types and narrowing with typeof
Discriminated unions, and how tsc finds the case you forgot
TypeScript generics, including a constraint (T extends an object with an id)
Utility types: Omit, Partial, Pick, Readonly, Record
Strict mode catching a real bug: 'user' is possibly 'undefined'
Typed fetch with unknown and a type guard (JSONPlaceholder API)
A typed task CLI with a discriminated union of commands
A bug TypeScript did NOT catch, and how it was fixed
Chapters:
0:00 Intro
0:47 Setup
1:27 Types
1:54 Interfaces & type aliases
3:06 Unions & narrowing
4:38 Generics
5:17 Utility types
6:00 Strict mode catches a real bug
7:10 Real app: typed fetch
8:02 Real app: task CLI
9:33 A bug TypeScript missed
10:18 Recap
Code: see the code link in the pinned comment (code.zip).
More crash courses on this channel: JavaScript, React, Node.js, Python and Java.
#typescript #javascript #typescripttutorial #nodejs #webdevelopment