Skip to content

Nominal

API Reference / privatefolio-backend / interfaces / Nominal

Nominal<T, Name> = T & object

Defined in: interfaces.ts:331

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

Usage:

[species]: Name

T

Name extends string

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'>;