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

Function makeTuple

packages/effect/src/Schema.ts:4367–4381  ·  view source on GitHub ↗
(ast: SchemaAST.Arrays, elements: Elements)

Source from the content-addressed store, hash-verified

4365}
4366
4367function makeTuple<Elements extends Tuple.Elements>(ast: SchemaAST.Arrays, elements: Elements): Tuple<Elements> {
4368 return make(ast, {
4369 elements,
4370 mapElements<To extends Tuple.Elements>(
4371 this: Tuple<Elements>,
4372 f: (elements: Elements) => To,
4373 options?: {
4374 readonly unsafePreserveChecks?: boolean | undefined
4375 } | undefined
4376 ): Tuple<Simplify<Readonly<To>>> {
4377 const elements = f(this.elements)
4378 return makeTuple(SchemaAST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements)
4379 }
4380 })
4381}
4382
4383/**
4384 * Defines a fixed-length tuple schema from an array of element schemas.

Callers 2

mapElementsFunction · 0.85
TupleFunction · 0.85

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected