| Start |
|---|
| String Literal Types String literal types allow you to specify the exact value a string can have. Any other string will give a error. Together with Type Aliases and Union Types you get a enum-like behavior. String Literal Types can be used to distinguish overloads. They works well for User-Defined Type Guards. Full example code |
| Tuple Array type with known and possibly different types: |
| Boolean A boolean represents the most basic datatype in TypeScript, with the purpose of assigning true/false values. |
| Intersection Types A Intersection Type combines the member of two or more types. |
| Number Like JavaScript, numbers are floating point values. ECMAScript 2015 allows binary and octal. |
| String Textual data type: |
| Array An array of values: |
| Enum A type to name a set of numeric values: Number values default to 0: Set a default starting number: or assign values: |
| Any When unsure of a type, |
| Void If you have no type at all, commonly used for functions that do not return anything:
|
| Types in function arguments and return value. Number When you create a function in TypeScript you can specify the data type of the function's arguments and the data type for the return value Example: Here the syntax Usage: Note: You can not do so or it will receive the following errors:
|
| Types in function arguments and return value. String Example: Here the syntax Usage: |
| const Enum A const Enum is the same as a normal Enum. Except that no Object is generated at compile time. Instead, the literal values are substituted where the const Enum is used. For comparison, a normal Enum Syntax
|
Read Article
https://develop.horje.com/learn/1434/reference