TypeScript
Static, Tuple, Condition Never

Static

Syntax

The static members of a class are accessed using the class name and dot notation, without creating an object

Compile version

Why use static?

A Static member is shared between all instances and is good to use it to save memory.

Tuple

Syntax

Tuple types allow you to express an array with a fixed number of elements whose types are known, but need not be the same.

Syntax

Tuple types allow you to express an array with a fixed number of elements whose types are known, but need not be the same.

Syntax

Tuple types allow you to express an array with a fixed number of elements whose types are known, but need not be the same.

Optional elements

Tuples vs Array

We need tuples to store data in an unchanging array. Like in examples with coordinates or chartData TS will tell us about the wrong array data structure.

Condition Never

Syntax

With never type we can exclude some undesired types

Syntax

With never type we can exclude some undesired types

Syntax

With never type we can exclude some undesired types

Thanks for your attention

TypeScript. Static, Tuple, Condition Never

By TenantCloud

TypeScript. Static, Tuple, Condition Never

Some useful feature of TS without proper attention to them

  • 145