Branded<T, U>: T & {
    [symbol]: U;
}

Creates a branded type of T with the brand U.

Type Parameters

  • T

    Type to brand

  • U

    Label

Branded type

type Result = Branded<string, 'foo'>
// ^? type Result = string & { [symbol]: 'foo' }