A collection of utilities that makes your TS code safer and cleaner

Home - Documentation

Motivation

Powerful features like assertion functions or user-defined type guards are only useful if paired with utility functions.

TypeScript, however, only exports type helpers (e.g. Record, ReturnType, etc.).

This module provides «the missing builtins» such as the assert function.

tsafe also corrects frustrating aspect of default utility type see ReturnType for example.

Import in deno:

import { assert, typeGuard, ... } from "https://deno.land/x/tsafe/mod.ts";

Install elsewhere:

$ npm install --save tsafe
#OR
$ yarn add tsafe

Learn more