358.11K
Категория: ПрограммированиеПрограммирование

Typescript

1.

Typescript
JavaScript with syntax for types

2.

Basic types
Boolean
Number
String
Array
Tuple
Enum
Unknow
Any
Void
Null
Undefined
Never
Object

3.

Types

4.

Types
• Basic type:
Boolean, string and etc…
• You can create you own type

5.

Union type
Types
const a = string |
number;

6.

Type Assertions

7.

Narrowing or type Guard
Fix:

8.

Interfaces

9.

Interfaces
Interfaces 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 Expressions
Function
• Generic Functions
• Function Overloads

14.

Function
Type
Expressions

15.

Function
Generic

16.

Function Overload
English     Русский Правила