TypeScript internally makes use of type widening and type narrowing. Type narrowing reduces the possibilities of values which a variable can take. The opposite case is called type widening. This video shows you these special cases and how to work with them.
My FREE programming apps:
https://apps.apple.com/app/id659282498
https://play.google.com/store/apps/de...
My FREE TypeScript Course:
https://typescript.tv/
Timeline:
00:00 Wide Types & Narrow Types
02:10 Type Widening & Type Narrowing
02:46 Type Widening in Variables
05:45 Type Widening in Arrays
07:37 Type Widening in Functions
09:55 Type Narrowing for union types
13:34 Type Widening in Literals
TypeScript errors being shown: TS2322, TS2345 & TS2367.
Resources:
➜ https://github.com/microsoft/TypeScri...
➜ https://github.com/Microsoft/TypeScri...
Follow TypeScript TV:
🌐 https://typescript.tv
🐦 / typescripttv
📺 / typescripttv
Hashtags:
#TypeScript #JavaScript #CodeNewbie #Programming