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

Function makeTuple

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

Source from the content-addressed store, hash-verified

4447}
4448
4449function makeTuple<Elements extends Tuple.Elements>(ast: SchemaAST.Arrays, elements: Elements): Tuple<Elements> {
4450 return make(ast, {
4451 elements,
4452 mapElements<To extends Tuple.Elements>(
4453 this: Tuple<Elements>,
4454 f: (elements: Elements) => To,
4455 options?: {
4456 readonly unsafePreserveChecks?: boolean | undefined
4457 } | undefined
4458 ): Tuple<Simplify<Readonly<To>>> {
4459 const elements = f(this.elements)
4460 return makeTuple(SchemaAST.tuple(elements, options?.unsafePreserveChecks ? this.ast.checks : undefined), elements)
4461 }
4462 })
4463}
4464/**
4465 * Defines a tuple schema from a fixed-length tuple of element schemas.
4466 *

Callers 2

mapElementsFunction · 0.85
TupleFunction · 0.85

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected