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.
15 lines (14 loc) • 521 B
TypeScript
import * as e from "fp-ts/lib/Either";
import { SmartTypeRefined } from "./utilTypes";
interface Sizeable {
length: number;
}
export declare type WithLength<Min extends number, Max extends number, A extends Sizeable> = SmartTypeRefined<A, "WithLength", {
min: Min;
max: Max;
}>;
export declare const mkWithLength: <Min extends number, Max extends number>(min: Min, max: Max) => <A extends Sizeable>(value: A) => e.Either<string, SmartTypeRefined<A, "WithLength", {
min: Min;
max: Max;
}>>;
export {};