際際滷

際際滷Share a Scribd company logo
TYPESCRIPT MAGIC
WHAT IS TYPESCRIPT?
 Javascript that scales
 Javascript with Types
 *Credits: Milosz Piechocki
course on Advanced
Typescript
STRICT TYPES
COMPILER FLAGS
 No Implicity Any
 strictNullChecks
 strictNullChecks
 strictFunctionTypes
 strictBindCallApply
 strictPropertyInitialization
 noImplicitThis
UNKNOWN TYPE
STRICT NULL CHECKS
 Thomas Hoare, a famous and influential computer scientist
 innumerable errors, vulnerabilities, and system crashes, which
have probably caused a billion dollars of pain and damage in
the last forty years.
STRICT NULL CHECKS
STRICT PROPERTY INITIALIZATION
OPTIONALITY?
GENERICS
 Why do we need generics?
 Just to Simplify
GENERIC FUNCTIONS
TYPE ARGUMENT CONSTRAINTS
 some restrictions on type argument
COMPOSING TYPES
 Union And Intersection
DISCRIMINTATED UNION TYPES
 Creating discriminated unions is an extremely powerful way of
composing types.
 Discriminated unions let you enforce some business logic
rules at compile-time.
STATE MACHINE
POLYMORPHISM VS DISCRIMINATED TYPE
MORE TYPES
INFER
TYPE GUARD
NOMINAL TYPING
GAURAV SEHRAWAT
 Github: igauravsehrawat
 Twitter: Root3d
THANK YOU

More Related Content

Typescript magic