MCPcopy Create free account
hub / github.com/Effect-TS/effect / structWithRest

Function structWithRest

packages/effect/src/SchemaAST.ts:3320–3338  ·  view source on GitHub ↗
(ast: Objects, records: ReadonlyArray<Objects>)

Source from the content-addressed store, hash-verified

3318
3319/** @internal */
3320export 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 */
3341export function tupleWithRest(ast: Arrays, rest: ReadonlyArray<AST>): Arrays {

Callers

nothing calls this directly

Calls 2

someMethod · 0.80
combineChecksFunction · 0.70

Tested by

no test coverage detected