🔩 The missing TypeScript utils
See the code
A collection of utilities to take your TypeScript development up a notch
This module is tree shakable
Make sure two types are identical
Playground
A assertion function that typescript understands
Make sure your zod schema exactly matches a given type:
Playground
Make sure you never forget a case in a switch
Playground
Make TypeScript believe whatever you say without having to write const obj2 = obj as Bar.
The more powerfully is to be able to tell TypeScript that obj ist not of type Bar:
Powerful TypeScript 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 and other utilities that cannot be just type helpers.
tsafe is both an NPM and a Deno module.
(Achieved with denoify)
import { assert, type Equals, ... } from "https://deno.land/x/tsafe/mod.ts";
$ npm install --save tsafe
Overall
Maintained
Code review
npm
Latest release
Releases this year
325 followers · starred Aug 2023
724 followers · starred Sep 2024
222 followers · starred Sep 2022
191 followers · starred Apr 2022
🔩 The missing TypeScript utils
See the code
A collection of utilities to take your TypeScript development up a notch
This module is tree shakable
Make sure two types are identical
Playground
A assertion function that typescript understands
Make sure your zod schema exactly matches a given type:
Playground
Make sure you never forget a case in a switch
Playground
Make TypeScript believe whatever you say without having to write const obj2 = obj as Bar.
The more powerfully is to be able to tell TypeScript that obj ist not of type Bar:
Powerful TypeScript 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 and other utilities that cannot be just type helpers.
tsafe is both an NPM and a Deno module.
(Achieved with denoify)
import { assert, type Equals, ... } from "https://deno.land/x/tsafe/mod.ts";
$ npm install --save tsafe
Overall
Maintained
Code review
npm
Latest release
Releases this year
325 followers · starred Aug 2023
724 followers · starred Sep 2024
222 followers · starred Sep 2022
191 followers · starred Apr 2022