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

Method constructor

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

Source from the content-addressed store, hash-verified

283
284export class StructureNode extends BaseConstraint<Structure.Declaration> {
285 constructor(...args: ConstructorParameters<typeof BaseConstraint>) {
286 super(...args)
287 // a set engine rejects duplicate keys in order with its other reduce errors
288 if (!$ark.sets) {
289 const seen: Record<Key, true | undefined> = Object.create(null)
290 for (const prop of this.props) {
291 if (prop.key in seen)
292 throwParseError(writeDuplicateKeyMessage(prop.key))
293 seen[prop.key] = true
294 }
295 }
296 this.alters ||= this.structMorph !== undefined
297 }
298
299 // JSON lists each kind of constraint and each prop's key in order
300 override sameInner(r: StructureNode): boolean | undefined {

Callers

nothing calls this directly

Calls 2

throwParseErrorFunction · 0.90
writeDuplicateKeyMessageFunction · 0.85

Tested by

no test coverage detected