typesafe-ts API Documentation - v1.5.1
    Preparing search index...

    Type Alias Brand<T, Brand>

    Brand: T & { "[brand_symbol]": Brand }

    A branded type that combines a base type with a unique brand identifier. Brands create nominal types in TypeScript, making structurally equivalent values non-assignable. This is the type returned by apply_brand() / brand.apply(). The runtime brand set by apply_brand/brand.apply can be used as a union discriminant at runtime.

    The brand is stored using a unique symbol (brand.symbol), which guarantees it will not conflict with any properties from other tools, libraries, or your own code.

    Type Parameters

    • T extends BrandableTypes

      The underlying type to be branded

    • Brand extends string

      A string literal type that serves as the unique brand identifier