UNPKG

fast-check-io-ts

Version:

io-ts codec to fast-check arbitrary mapping

26 lines (25 loc) 1.11 kB
import * as fc from 'fast-check'; import * as t from 'io-ts'; interface ArrayType extends t.ArrayType<HasArbitrary> { } interface RecordType extends t.DictionaryType<t.StringType, HasArbitrary> { } interface StructType extends t.InterfaceType<{ [K: string]: t.TypeOf<HasArbitrary>; }> { } interface ExactType extends t.ExactType<HasArbitrary> { } interface TupleType extends t.TupleType<Array<HasArbitrary>> { } interface PartialType extends t.PartialType<Record<string, HasArbitrary>> { } interface UnionType extends t.UnionType<Array<HasArbitrary>> { } interface IntersectionType extends t.IntersectionType<Array<HasArbitrary>> { } interface BrandedType extends t.RefinementType<HasArbitrary> { } export declare type HasArbitrary = t.UnknownType | t.UndefinedType | t.NullType | t.VoidType | t.StringType | t.NumberType | t.BooleanType | t.KeyofType<any> | t.LiteralType<any> | ArrayType | RecordType | StructType | ExactType | PartialType | TupleType | UnionType | IntersectionType | BrandedType; export declare function getArbitrary<T extends HasArbitrary>(codec: T): fc.Arbitrary<t.TypeOf<T>>; export {};