Type Annotation
↔ TS Syntax to annotate Variables with Types
Angle Bracket Notation
<\>
Type Expression to define Generic Type Placeholder
Type Annotation provide Syntactic Sugar for checking Types of objects at Compile Time
built-in JS functions (ie JSON.parse()
) return any
by default - always will need manual Type Annotation
References
Type Inference
↔ (feature) TSC to auto-derive implicit Type for Variable (w/o explicit Type Annotation)Alias
↔ custom Type to store & reuse Type Annotation & improve ReadabilityObject Literal Type
↔ Type Annotation for Object Literal, use for inline anon Object pass as argObject Optional Property
↔?:
Type Annotation to mark optional object propertyFunction Signature
↔ Type Annotation to define function I/OVariadic Tuple
↔ Tuple Type Annotation using Spread Operator or Rest Parameter, to define varying number of element typesTyped Callback Function
↔ Type Annotation for Anon Function pass as arg to function