MCPcopy Create free account
hub / github.com/arktypeio/arktype / parseMorphTuple

Function parseMorphTuple

ark/type/parser/tupleExpressions.ts:483–491  ·  view source on GitHub ↗
(def, ctx)

Source from the content-addressed store, hash-verified

481export type ArgTwoOperator = Exclude<IndexOneOperator, "?" | "=">
482
483export const parseMorphTuple: IndexOneParser<"=>"> = (def, ctx) => {
484 assertTupleArity(def, "=>", 3)
485 if (typeof def[2] !== "function") {
486 return throwParseError(
487 writeMalformedFunctionalExpressionMessage("=>", def[2])
488 )
489 }
490 return ctx.$.parseOwn(def[0], ctx).pipe(def[2] as Morph)
491}
492
493export const writeMalformedFunctionalExpressionMessage = (
494 operator: ":" | "=>",

Callers

nothing calls this directly

Calls 4

throwParseErrorFunction · 0.90
assertTupleArityFunction · 0.85
parseOwnMethod · 0.45

Tested by

no test coverage detected