UNPKG

smart-types-ts

Version:

A collection of _Smart Types_ and _Smart Constructors_ which enable you to be more strict when defining your application's important types/interfaces.

6 lines (3 loc) 187 B
import * as e from "fp-ts/lib/Either"; const isNumber = (val: unknown): val is number => typeof val === "number"; export const number = e.fromPredicate(isNumber, () => "Not a number");