( def: unknown, ctx: BaseParseContext )
| 37 | export type ParsedOptionalProperty = readonly [BaseRoot, "?"] |
| 38 | |
| 39 | export const parseProperty = ( |
| 40 | def: unknown, |
| 41 | ctx: BaseParseContext |
| 42 | ): ParsedProperty => { |
| 43 | if (isArray(def)) { |
| 44 | if (def[1] === "=") { |
| 45 | assertTupleArity(def, "=", 3) |
| 46 | return [ctx.$.parseOwn(def[0], ctx), "=", def[2]] |
| 47 | } |
| 48 | |
| 49 | if (def[1] === "?") { |
| 50 | assertTupleArity(def, "?", 2) |
| 51 | return [ctx.$.parseOwn(def[0], ctx), "?"] |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | // string-embedded defaults/optionals are handled by the string parser |
| 56 | return parseInnerDefinition(def, ctx) |
| 57 | } |
| 58 | |
| 59 | export type validateProperty<def, keyKind extends ParsedKeyKind, $, args> = |
| 60 | // validateInnerDefinition returns any or never as is |
no test coverage detected