Open this example in the interactive library
Source code
type Brand<T, Name extends string> = T & { readonly __brand: Name };
console.log(
new Map<Brand<number, "OrderId">, string>([
[1 as Brand<number, "OrderId">, "ready"],
]).get(1 as Brand<number, "OrderId">),
);
Sample output
ready
