Skip to main content

TS Syntax ↔ List of typescript keywords, syntax, coding patterns, etc

aka lang

Type

shape & behaviour of data to rep set of values

Generics

generic (algebraic) placeholder to work with any variety of Types, but allow Type Inference to catch specific Type

Source: www.typescriptlang.org/docs/handbook/2/generics.html

TS Keyword

Decorator

namespace

TS Syntax to group related Code (mainly for APIs)

Modules & TS

Type Guard

Runtime Type-Check to Narrow Type of Variable

TS with React

TS Operators

References

  1. namespaceTS Syntax to group related Code (mainly for APIs)

  2. Property ModifierTS Syntax to specify property's Type, if optional? & if writable?

  3. Typed Optional ParameterTS Syntax to mark Identifier as an optional Parameter using ?:

  4. SingletonTS Syntax Pattern to ensure exactly only one object instance of a class, using Private Constructor & Static Method

  5. Type AnnotationTS Syntax to annotate Variables with Types

  6. Type OperatorTS Syntax for built-in operation on Types

  7. Index SignatureTS Syntax to express Dictionary with arbitrary key map to value

  8. Type ExpressionTS Syntax evalue to Type, after : || inside Angle Bracket Notation

  9. Typed [Rest Parameter](rest-parameter)TS Syntax for Rest Parameter which must always be of Type Array

  10. Type AssertionTS Syntax to override TSC's Type Inference for Static Type of specific Value