TIP: Check this page code to see TypeScript features in action
Generics are a way to make components reusable across different types.
1
2
3
a
b
c
Union types allow you to have multiple types for a single variable.
1
a
2
b
Readonly arrays can't be modified.
10
20
30
Tuples are fixed-length arrays that can have multiple types in them.
string
true
John
35
Enums allow you to create a set of named constants.
#f00
#0f0
#00f
Enums can also be numbered, and the following values will be incremented
1
2
3
Type aliases are a way to define custom types in TypeScript.
Hello Type Alias
Interfaces are generally used when defining objects instead of types.
John is 35 years old
Interfaces can be extended to add more properties.
John is 35 years old and his email is john@email.com