index overview
Added in v0.1.0
Table of contents
utils
getArb
Given an Arbitrary instance for each member of A, returns an Arbitrary instance for all A.
Signature
export declare const getArb: <A extends Sum.AnyMember>(sum: Sum.Sum<A>) => (arbs: Arbs<A>) => fc.Arbitrary<A>
Example
import * as Sum from '@unsplash/sum-types'
import { getArb, nullaryArb } from '@unsplash/sum-types-fast-check'
import fc from 'fast-check'
type Weather = Sum.Member<'Sun'> | Sum.Member<'Rain', number>
const Weather = Sum.create<Weather>()
const arbWeather = getArb(Weather)({
  Sun: nullaryArb,
  Rain: fc.integer(),
})
Added in v0.1.0
nullaryArb
An Arbitrary for nullary member constructors.
Signature
export declare const nullaryArb: fc.Arbitrary<null>
Added in v0.1.0