UNPKG

effect-ts-laws

Version:
56 lines 2.76 kB
import type { ParameterOverrides } from '#law'; import type { Mono, MonomorphicGiven, MonomorphicGivenOf, TypeclassInstances } from '#laws'; import type { TypeLambda } from 'effect/HKT'; import { MonoProps } from '../laws/typeclass/monomorphic/props.js'; /** * Test typeclass laws on the given instances of some datatype `F`. All laws are * monomorphic on an underlying type `A`. * @param given - Test options for the datatype under test. * @category vitest */ export declare const testTypeclassLawsFor: <F extends TypeLambda, A, R = never, O = unknown, E = unknown>(given: MonomorphicGivenOf<F, A, R, O, E>) => <Ins extends TypeclassInstances<F, A, R, O, E>>( /** * Instances to test. Key is typeclass name and value is the instance under * test. For example, `{ Monad: Option.Monad }` will run the monad typeclass * laws on `Option`. */ instances: Ins, /** Optional runtime `fast-check` parameters. */ parameters?: ParameterOverrides) => void; /** * Test typeclass laws on the given instances of some datatype `F`. All laws are * monomorphic on an underlying type of `Option<number@.`. * At the property `testTypeclassLaws.underlyingProps` you will find the same * function, except it uses the underlying type `{x: number; y: string}, useful * when testing laws on React components, as they can only accept a single * object argument. * @param given - Test options for the datatype under test. * @category vitest */ export declare const testTypeclassLaws: { <F extends TypeLambda, R = never, O = unknown, E = unknown>(given: MonomorphicGiven<F, R, O, E>): <Ins extends TypeclassInstances<F, Mono, R, O, E>>( /** * Instances to test. Key is typeclass name and value is the instance under * test. For example, `{ Monad: Option.Monad }` will run the monad typeclass * laws on `Option`. */ instances: Ins, /** Optional runtime `fast-check` parameters. */ parameters?: ParameterOverrides) => void; /** * Test typeclass laws on the given instances of some datatype `F`. All laws are * monomorphic on an underlying type of `{x: number; y: string}`. * @param given - Test options for the datatype under test. * @category vitest */ underlyingProps: <F extends TypeLambda, R = never, O = unknown, E = unknown>(given: MonomorphicGiven<F, R, O, E>) => <Ins extends TypeclassInstances<F, MonoProps, R, O, E>>( /** * Instances to test. Key is typeclass name and value is the * instance under test. For example, `{ Monad: Option.Monad }` will run the * monad typeclass laws on `Option`. */ instances: Ins, /** Optional runtime `fast-check` parameters. */ parameters?: ParameterOverrides) => void; }; //# sourceMappingURL=monomorphic.d.ts.map