import type { ExtractGeneric, IsAnyOrUnknown, KeyOfUnion } from '.'; export declare const BRANDS: unique symbol; export type BRANDS = typeof BRANDS; export declare const WITNESS: unique symbol; export type WITNESS = typeof WITNESS; type RearrangeKeysAndUseWitness = T[WITNESS] & { [WITNESS]: T[WITNESS]; [BRANDS]: { [K in keyof T[BRANDS]]: T[BRANDS][K]; }; }; type BRAND = string | { [BRANDS]: unknown; }; type GetBrands = { [K in (U extends Array ? (Extract, string> | KeyOfUnion, { [BRANDS]: unknown; }>[BRANDS]>) : U extends { [BRANDS]: unknown; } ? keyof U[BRANDS] : U)]: true; }; export type Branded = RearrangeKeysAndUseWitness<{ [WITNESS]: T extends { [WITNESS]: unknown; } ? T[WITNESS] : T; [BRANDS]: (T extends { [BRANDS]: unknown; } ? T[BRANDS] & GetBrands : GetBrands); }>; export type Brand = Branded; export type IsBrand = (IsAnyOrUnknown extends true ? false : T extends { [WITNESS]: U; [BRANDS]: Record; } ? true : false); export {};