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

Method constructor

ark/schema/structure/index.ts:83–102  ·  view source on GitHub ↗
(...args: ConstructorParameters<typeof BaseConstraint>)

Source from the content-addressed store, hash-verified

81 }
82
83 constructor(...args: ConstructorParameters<typeof BaseConstraint>) {
84 super(...args)
85 const key = this.signature
86 // checked by equality first so intrinsic json parses without a set engine
87 if (
88 !key.equals($ark.kw.string) &&
89 !key.equals($ark.kw.symbol) &&
90 !key.equals($ark.kw.key) &&
91 !key.extends($ark.kw.key)
92 )
93 throwParseError(writeInvalidPropertyKeyMessage(key.expression))
94 const enumerableBranches = key.branches.filter(b => b.is("unit"))
95 if (enumerableBranches.length) {
96 throwParseError(
97 writeEnumerableIndexBranches(
98 enumerableBranches.map(b => printable(b.unit))
99 )
100 )
101 }
102 }
103
104 // its structure picks the keys it transforms by the signature's Allows
105 protected override get ctxSel(): boolean {

Callers

nothing calls this directly

Calls 9

throwParseErrorFunction · 0.90
printableFunction · 0.90
extendsMethod · 0.80
filterMethod · 0.80
isMethod · 0.80
equalsMethod · 0.65
mapMethod · 0.65

Tested by

no test coverage detected