TypeLib JS

Detect and debug Type Errors over 35 types of data in less than 6 KB. Also classifies data in 9 groups.

typeof

type().is typeof

See how it groups data:

type().isNumber type().isFunction type().isTruthy type().isNullish type().kinds

Made for developers who are always looking for the right type

Get started! Keep learning

Types debugging are a lot easier

With the typeErrorIf function you can easily throw and catch errors

Throwing and catching

Console #throw-catch

Great for team collab

Save time and head scratching by doing specific type checking

Creating a file

Console #create-file

Do strict type checking

Reduce mistakes and new “open issues”, feel secure of what type of data you can expect

Verifying numbers and objects

Console #strict-checking

Readonly by default

The data you verify with the type function by default will be readonly

Trying to alter verified data

Console #safe-types

Get started

npm install typelib-js // import type from "typelib-js" // const type = require("typelib-js")
yarn add typelib-js // import type from "typelib-js" // const type = require("typelib-js")
pnpm install typelib-js // import type from "typelib-js" // const type = require("typelib-js")
git clone https://github.com/schemetastic/typelib-js.git // <script src="dist/typelib.min.js"> <script> // import type from "./dist/typelib.es.min.js"

In TypeLib JS, [] and null are not objects, are "array" and "null"; 0/0 is "nan"; 1000/0 is "infinity"; And please don't forget to give me a star

Documentation