Skip to main content

Duck TType

Compile-time type testing plus 200+ TypeScript utility types. Primitives, predicates, tuples, brands, and more.

200+ utility types

Type tests that run in `tsc`

Compile-time assertions plus a library of utility types. Catch type regressions during type-check, not during the next `git blame`.

AssertTrue / AssertFalse

Compile-time boolean assertions with custom error messages. Failing tests show as red underlines in your editor.

Expect<Equal>

Structural equality at the type level. Catches widening, distributive drift, and excess-property regressions.

200+ utilities

Primitives, predicates, strings, tuples, objects, numbers, unions, brands. Imported individually via subpath exports.

Zero runtime

The `.js` files are intentionally empty. Every utility is erased at build time. No bundle impact, no tree-shaking needed.

Tree-shakeable subpaths

Import `@gentleduck/ttest/string` or `/tuple`. Each domain is its own entry. You only pay for what you import.

Framework-free

No Jest, no vitest, no runner. `tsc --noEmit` is the whole story. Works in any TypeScript project, editor, or CI.

Install

Install as a devDep. Write tests in `.test-d.ts` files. `tsc` runs them.

# Install
bun add -D @gentleduck/ttest

# Write a type test
import type { AssertTrue, Equal } from '@gentleduck/ttest/assert'

type _test = AssertTrue<Equal<Uppercase<'gentle'>, 'GENTLE'>, 'uppercase works'>

Free & open source

gentleduck is MIT licensed and will always be free and open source. Every package ships with full source access — fork it, modify it, own it.

Become a Sponsor