Skip to main content
Module

x/ts_brand/mod.ts>make

Reusable type branding in TypeScript
Latest
function make
import { make } from "https://deno.land/x/ts_brand@0.0.1/mod.ts";

Produces a Brander<B>, given a brand type B. This simply returns identity but relies on type inference to give the return type the correct type.

Examples

Example 1

type UserId = Brand<number, 'user'>;
const UserId = make<UserId>();
const myUserId = UserId(42);

Returns

identity