Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ts_essentials/lib/mod.ts>Opaque

All basic TypeScript types in one place 🤙
Latest
type alias Opaque
import { type Opaque } from "https://deno.land/x/ts_essentials@v9.1.2/lib/mod.ts";

Easily create opaque types ie. types that are subset of their original types (ex: positive numbers, uppercased string)

Type Parameters

Type
Token extends string
definition: Token extends StringLiteral<Token> ? Type & { readonly [__OPAQUE_TYPE__]: Token; } : never