(...args: ConstructorParameters<typeof BaseProp>)
| 67 | |
| 68 | export class OptionalNode extends BaseProp<"optional"> { |
| 69 | constructor(...args: ConstructorParameters<typeof BaseProp>) { |
| 70 | super(...args) |
| 71 | if (!$ark.sets && this.$.cfg.exactOptionalPropertyTypes === false) |
| 72 | throwParseError(missingSetEngineMessage) |
| 73 | if ("default" in this.inner) { |
| 74 | // a default of undefined would replace undefined with itself |
| 75 | assertDefaultValueAssignability( |
| 76 | this.requiredValue, |
| 77 | this.inner.default, |
| 78 | this.key, |
| 79 | this |
| 80 | ) |
| 81 | } |
| 82 | // a function default can fail as it's applied, like a morph |
| 83 | this.hasMorph ||= typeof this.inner.default === "function" |
| 84 | this.ctxMorph ||= this.defMorph?.length === 2 |
| 85 | } |
| 86 | |
| 87 | override getIo(ioKind: "in" | "out"): BaseNode { |
| 88 | if (ioKind === "out" || !this.hasDef()) return super.getIo(ioKind) |
nothing calls this directly
no test coverage detected