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 isString = (val: unknown): val is string => typeof val === "string"; export const string = e.fromPredicate(isString, () => "Not a string");