import * as Function from "./Function"; import * as Types from "./Types"; declare const BrandTypeId: unique symbol; export type BrandTypeId = typeof BrandTypeId; declare const ConstructorTypeId: unique symbol; export type ConstructorTypeId = typeof ConstructorTypeId; export interface Brand { readonly [BrandTypeId]: { readonly [k in K]: K; }; } export declare namespace Brand { export interface Constructor> { readonly [ConstructorTypeId]: ConstructorTypeId; (args: Brand.Unbranded): A; } export type Unbranded

= P extends infer Q & Brands

? Q : P; export type Brands

= P extends Brand ? Types.UnionToIntersection<{ [k in keyof P[BrandTypeId]]: k extends string | symbol ? Brand : never }[keyof P[BrandTypeId]]> : never; } export type Branded = A & Brand; export const nominal = >(): Brand.Constructor => { return Function.identity as Brand.Constructor; };