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
TextendsBrandableTypes
The underlying type to be branded
Brandextendsstring
A string literal type that serves as the unique brand identifier
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.