Const
The number schema validates that the input is a number, and not NaN.
number
NaN
import { number } from "typerun/schema";import { is } from "typerun";if (is(number)(42)) { console.log("42 is a number");}if (!is(number)(true)) { console.log("true is not a number");}if (!is(number)(NaN)) { console.log("NaN is not a number");} Copy
import { number } from "typerun/schema";import { is } from "typerun";if (is(number)(42)) { console.log("42 is a number");}if (!is(number)(true)) { console.log("true is not a number");}if (!is(number)(NaN)) { console.log("NaN is not a number");}
The
number
schema validates that the input is a number, and notNaN
.Example