UNPKG

pragmatic-fp-ts

Version:

Opinionated functional programming library with easy use in mind

11 lines (10 loc) 649 B
import { Validator } from "./validate"; import { Either } from "./Either"; export type Decoder<T = any> = (_: unknown) => Either<T, Error>; export type DecoderTarget<T extends Decoder<any>> = T extends Decoder<infer U> ? U : never; declare const Decoder: <T extends unknown>(validate: Validator<T> | Decoder<T>, parse?: (_: string) => any) => Decoder<T>; declare const _default: { from: <T>(name: string, validate: (_: unknown) => _ is T, parse?: ((_: string) => any) | undefined) => Decoder<T>; Decoder: <T_1 extends unknown>(validate: Validator<T_1> | Decoder<T_1>, parse?: (_: string) => any) => Decoder<T_1>; }; export default _default;