t.behrendt
  • Joined on 2023-04-28

@t.behrendt/tst (0.1.11)

Published 2026-07-28 06:38:20 +02:00 by t.behrendt

Installation

@t.behrendt:registry=https://gitea.t000-n.de/api/packages/t.behrendt/npm/
npm install @t.behrendt/tst@0.1.11
"@t.behrendt/tst": "0.1.11"

About this package

tst

A library for hyper-typing in TypeScript.

Branding

Branding allows you to create truly unique types based on primitive types. Brands prvents accidental mixing of types like assigning a ProductId to a UserId.

Usage

type Branded<T, B extends symbol> = T & { [brand]: B };

Example:

const userIdBrand = Symbol("UserId");
type UserId = Branded<string, typeof userIdBrand>;
const userId: UserId = "123";
userId.brand === userIdBrand; // true

Dependencies

Development Dependencies

ID Version
@types/bun latest
oxfmt 0.59.0
oxlint 1.74.0
typescript 7.0.2
Details
npm
2026-07-28 06:38:20 +02:00
0
Timo Behrendt <t.behrendt@t00n.de>
MIT
latest
1.5 KiB
Assets (1)
tst-0.1.11.tgz 1.5 KiB
Versions (13) View all
0.1.11 2026-07-28
0.1.10 2026-07-28
0.1.9 2026-07-22
0.1.8 2026-07-22
0.1.7 2026-07-22