First brand to intersect
Second brand to intersect
type PositiveNumber = Brand<number, 'positive'>;
type IntegerNumber = Brand<number, 'integer'>;
type PositiveInteger = IntersectBrand<PositiveNumber, IntegerNumber>;
// Brand<number, 'positive' | 'integer'>
type Named = Brand<{ name: string }, 'named'>;
type Aged = Brand<{ age: number }, 'aged'>;
type Person = IntersectBrand<Named, Aged>;
// Brand<{ name: string } & { age: number }, 'named' | 'aged'>
Creates an intersection of two branded types. The result has the intersection of value types and the union of all keys.