(
isMutable: boolean,
elements: ReadonlyArray<AST>,
rest: ReadonlyArray<AST>,
annotations?: Schema.Annotations.Annotations,
checks?: Checks,
encoding?: Encoding,
context?: Context,
encodingChecks?: Checks
)
| 1682 | readonly encodingChecks: Checks | undefined |
| 1683 | |
| 1684 | constructor( |
| 1685 | isMutable: boolean, |
| 1686 | elements: ReadonlyArray<AST>, |
| 1687 | rest: ReadonlyArray<AST>, |
| 1688 | annotations?: Schema.Annotations.Annotations, |
| 1689 | checks?: Checks, |
| 1690 | encoding?: Encoding, |
| 1691 | context?: Context, |
| 1692 | encodingChecks?: Checks |
| 1693 | ) { |
| 1694 | super(annotations, checks, encoding, context) |
| 1695 | this.isMutable = isMutable |
| 1696 | this.elements = elements |
| 1697 | this.rest = rest |
| 1698 | this.encodingChecks = encodingChecks |
| 1699 | |
| 1700 | let hasOptional = false |
| 1701 | for (let i = 0; i < elements.length; i++) { |
| 1702 | if (isOptional(elements[i])) { |
| 1703 | hasOptional = true |
| 1704 | } else if (hasOptional) { |
| 1705 | throw new Error("A required element cannot follow an optional element. ts(1257)") |
| 1706 | } |
| 1707 | } |
| 1708 | if (hasOptional && rest.length > 1) { |
| 1709 | throw new Error("A required element cannot follow an optional element. ts(1257)") |
| 1710 | } |
| 1711 | |
| 1712 | // An optional element cannot follow a rest element.ts(1266) |
| 1713 | for (let i = 1; i < rest.length; i++) { |
| 1714 | if (isOptional(rest[i])) { |
| 1715 | throw new Error("An optional element cannot follow a rest element. ts(1266)") |
| 1716 | } |
| 1717 | } |
| 1718 | } |
| 1719 | /** @internal */ |
| 1720 | getParser( |
| 1721 | compile: SchemaParser.Compiler, |
nothing calls this directly
no test coverage detected