Open this example in the interactive library
Source code
type Brand<T, Name extends string> = T & { readonly __brand: Name };
console.log(
((s: number): Brand<number, "Milliseconds"> =>
(s * 1000) as Brand<number, "Milliseconds">)(2),
);
Sample output
2000
