TYPESCRIPTChapter 1 · TS Basics
Typing your variables
TypeScript is JavaScript with types. You annotate a variable with : type to specify the data it should hold. These annotations are checked during compilation and stripped in the running JavaScript.
Worked example
How it reads
- : string / : number / : boolean specify variable types
- Types are strictly checked by the compiler before running

Cloud tip: Let inference do the work: if you assign a value immediately, TypeScript can infer the type automatically.


