Type alias NominalStrict<K, T>

NominalStrict<K, T>: T & Readonly<{
    __brand: K;
}>

Creates a strict nominal type.

Type Parameters

  • K

  • T

Example

type Foo = NominalStrict<'Foo', number>;

const foo: Foo = 1;
// => Error: Type 'number' is not assignable to type 'Foo'.

Generated using TypeDoc