Similar presentations:
Typescript
1.
TypescriptJavaScript with syntax for types
2.
Basic typesBoolean
Number
String
Array
Tuple
Enum
Unknow
Any
Void
Null
Undefined
Never
Object
3.
Types4.
Types• Basic type:
Boolean, string and etc…
• You can create you own type
5.
Union typeTypes
const a = string |
number;
6.
Type Assertions7.
Narrowing or type GuardFix:
8.
Interfaces9.
InterfacesInterfaces declare type of object
10.
Interface or type ?Different
Type aliases and interfaces are very
similar, and in many cases you can
choose between them freely. Almost all
features of an interface are available
in type, the key distinction is that a type
cannot be re-opened to add new
properties vs an interface which is always
extendable.
11.
12.
Optional = Properties?13.
• Function Type ExpressionsFunction
• Generic Functions
• Function Overloads
14.
FunctionType
Expressions
15.
FunctionGeneric