ts-type-forge
    Preparing search index...

    Type Alias IntersectBrand<B1, B2>

    IntersectBrand: Brand<
        GetBrandValuePart<B1> & GetBrandValuePart<B2>,
        string & (UnwrapBrandTrueKeys<B1> | UnwrapBrandTrueKeys<B2>),
        string & (UnwrapBrandFalseKeys<B1> | UnwrapBrandFalseKeys<B2>),
    >

    Creates an intersection of two branded types. The result has the intersection of value types and the union of all keys.

    Type Parameters

    Brand with intersected value types and combined keys

    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'>