(ast: Objects, records: ReadonlyArray<Objects>)
| 3318 | |
| 3319 | /** @internal */ |
| 3320 | export function structWithRest(ast: Objects, records: ReadonlyArray<Objects>): Objects { |
| 3321 | if (ast.encoding || records.some((r) => r.encoding)) { |
| 3322 | throw new Error("StructWithRest does not support encodings") |
| 3323 | } |
| 3324 | let propertySignatures = ast.propertySignatures |
| 3325 | let indexSignatures = ast.indexSignatures |
| 3326 | let checks = ast.checks |
| 3327 | for (const record of records) { |
| 3328 | for (const propertySignature of record.propertySignatures) { |
| 3329 | if (propertySignatures.some((ps) => ps.name === propertySignature.name)) { |
| 3330 | throw new Error(`Duplicate identifier: ${JSON.stringify(propertySignature.name)}. ts(2300)`) |
| 3331 | } |
| 3332 | } |
| 3333 | propertySignatures = propertySignatures.concat(record.propertySignatures) |
| 3334 | indexSignatures = indexSignatures.concat(record.indexSignatures) |
| 3335 | checks = combineChecks(checks, record.checks) |
| 3336 | } |
| 3337 | return new Objects(propertySignatures, indexSignatures, undefined, checks) |
| 3338 | } |
| 3339 | |
| 3340 | /** @internal */ |
| 3341 | export function tupleWithRest(ast: Arrays, rest: ReadonlyArray<AST>): Arrays { |
nothing calls this directly
no test coverage detected