Skip to main content
Version: 4.2

Type alias: Nominal<T, Name>

Nominal<T, Name>: T & object

This is the generic type useful for declaring a nominal type, which does not structurally matches with the base type and the other types declared over the same base type

Examples

type Index = Nominal<number, 'Index'>;
// let i: Index = 42; // this fails to compile
let i: Index = 42 as Index; // OK
type TagName = Nominal<string, 'TagName'>;

Type declaration

[species]

[species]: Name

The 'name' or species of the nominal.

Type parameters

T

Name extends string