MCPcopy Create free account
hub / github.com/Effect-TS/effect / CustomArray

Function CustomArray

packages/effect/test/schema/toArbitrary.test.ts:53–65  ·  view source on GitHub ↗
(
  value: A,
  toArbitrary: Schema.Annotations.ToArbitrary.Declaration<ReadonlyArray<A["Type"]>, readonly [A]>
)

Source from the content-addressed store, hash-verified

51}
52
53function CustomArray<A extends Schema.Constraint>(
54 value: A,
55 toArbitrary: Schema.Annotations.ToArbitrary.Declaration<ReadonlyArray<A["Type"]>, readonly [A]>
56) {
57 return Schema.declareConstructor<ReadonlyArray<A["Type"]>>()(
58 [value],
59 () => (input, ast) =>
60 globalThis.Array.isArray(input)
61 ? Effect.succeed(input as ReadonlyArray<A["Type"]>)
62 : Effect.fail(new SchemaIssue.InvalidType(ast)),
63 { toArbitrary }
64 )
65}
66
67describe("Arbitrary generation", () => {
68 describe("Thrown errors", () => {

Callers 1

Calls 2

succeedMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected