UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

96 lines 3.39 kB
/** * @since 0.9.4 */ import { HKT, Kind, Kind2, URIS, URIS2 } from 'fp-ts/HKT'; import * as D from './Decoder'; import * as Eq from './Eq'; import * as G from './Guard'; import { Schemable, Schemable1, Schemable2C, WithRefine, WithRefine1, WithRefine2C, WithUnion, WithUnion1, WithUnion2C } from './Schemable'; /** * @category Model * @since 0.9.4 */ export interface Schema<A> { <S>(S: Schemable<S>): HKT<S, A>; } /** * @category Model * @since 0.9.5 */ export interface WithRefineSchema<A> { <S>(S: Schemable<S> & WithRefine<S>): HKT<S, A>; } /** * @category Model * @since 0.9.5 */ export interface WithUnionSchema<A> { <S>(S: Schemable<S> & WithUnion<S>): HKT<S, A>; } /** * @category Model * @since 0.9.5 */ export interface WithUnionRefineSchema<A> { <S>(S: Schemable<S> & WithUnion<S> & WithRefine<S>): HKT<S, A>; } /** * @category Constructor * @since 0.9.4 */ export declare function make<A>(schema: Schema<A>): Schema<A>; /** * @category Constructor * @since 0.9.5 */ export declare function withRefine<A>(schema: WithRefineSchema<A>): WithRefineSchema<A>; /** * @category Constructor * @since 0.9.5 */ export declare function withUnion<A>(schema: WithUnionSchema<A>): WithUnionSchema<A>; /** * @category Constructor * @since 0.9.5 */ export declare function create<A>(schema: WithUnionRefineSchema<A>): WithUnionRefineSchema<A>; /** * @since 0.9.4 * @category Type-level */ export declare type TypeOf<S> = S extends Schema<infer A> ? A : S extends WithRefineSchema<infer A> ? A : S extends WithUnionSchema<infer A> ? A : S extends WithUnionRefineSchema<infer A> ? A : never; /** * @since 0.9.5 * @category Combinator */ export interface Interpret { <S extends URIS2, E>(S: Schemable2C<S, E> & WithRefine2C<S, E> & WithUnion2C<S, E>): <A>(schema: WithUnionRefineSchema<A> | WithUnionSchema<A> | WithRefineSchema<A> | Schema<A>) => Kind2<S, E, A>; <S extends URIS2, E>(S: Schemable2C<S, E> & WithRefine2C<S, E>): <A>(schema: WithRefineSchema<A> | Schema<A>) => Kind2<S, E, A>; <S extends URIS2, E>(S: Schemable2C<S, E> & WithUnion2C<S, E>): <A>(schema: WithUnionSchema<A> | Schema<A>) => Kind2<S, E, A>; <S extends URIS2, E>(S: Schemable2C<S, E>): <A>(schema: Schema<A>) => Kind2<S, E, A>; <S extends URIS>(S: Schemable1<S> & WithRefine1<S> & WithUnion1<S>): <A>(schema: WithUnionRefineSchema<A> | WithRefineSchema<A> | WithUnionSchema<A> | Schema<A>) => Kind<S, A>; <S extends URIS>(S: Schemable1<S> & WithRefine1<S>): <A>(schema: WithRefineSchema<A> | Schema<A>) => Kind<S, A>; <S extends URIS>(S: Schemable1<S> & WithUnion1<S>): <A>(schema: WithUnionSchema<A> | Schema<A>) => Kind<S, A>; <S extends URIS>(S: Schemable1<S>): <A>(schema: Schema<A>) => Kind<S, A>; } /** * @since 0.9.4 * @category Combinator */ export declare const interpret: Interpret; /** * @since 0.9.5 * @category Combinator */ export declare const toDecoder: <A>(schema: WithUnionRefineSchema<A> | WithUnionSchema<A> | WithRefineSchema<A> | Schema<A>) => D.Decoder<unknown, A>; /** * @since 0.9.5 * @category Combinator */ export declare const toEq: <A>(schema: Schema<A>) => Eq.Eq<A>; /** * @since 0.9.5 * @category Combinator */ export declare const toGuard: <A>(schema: WithUnionRefineSchema<A> | WithRefineSchema<A> | WithUnionSchema<A> | Schema<A>) => G.Guard<unknown, A>; //# sourceMappingURL=Schema.d.ts.map