Name [Section] |
TypeScript type |
Possible values |
---|---|---|
Empty type [2.1.1] | never | No possible values |
Unit type [2.1.2] | void | One possible value |
Sum type [3.4.2] | number | string | A value from number or a value from string |
Tuple (product type) [3.1.1] | [number, string] | A value from number and a value from string |
Record (product type) [3.1.2] | { a: number; b: string; } | A (named) value from number and a (named) value from string |
Function type [5.1.2] | (value: number) => string | A function number → string |
Top type [7.2.1] | unknown | A value of any type |
Bottom type [7.2.2] | never | No possible values (the bottom type is the subtype of any other type) |
Interface [8.1] | interface ILogger { /* ... */ } | Object of a type that implements the ILogger interface |
Class [8.2.1] | class Square { /* ... */ } | Object of type Square |
Intersection type [8.4.3] | Square & Loggable | Object with members of both Square and of Loggable |
Generic class [9.2.1] | class List<T> { /* ... */ } | A generic class List with a type parameter T |
Generic function [9.1.1] | type Func<T, U> = (arg: T) => U; | A function from T → U where T and U are type parameters |
13.58.112.1