( x: AST.AST, y: AST.AST, path: ReadonlyArray<PropertyKey> )
| 3269 | export const mutable = <S extends Schema.Any>(schema: S): mutable<S> => make(AST.mutable(schema.ast)) |
| 3270 | |
| 3271 | const intersectTypeLiterals = ( |
| 3272 | x: AST.AST, |
| 3273 | y: AST.AST, |
| 3274 | path: ReadonlyArray<PropertyKey> |
| 3275 | ): AST.TypeLiteral => { |
| 3276 | if (AST.isTypeLiteral(x) && AST.isTypeLiteral(y)) { |
| 3277 | const propertySignatures = [...x.propertySignatures] |
| 3278 | for (const ps of y.propertySignatures) { |
| 3279 | const name = ps.name |
| 3280 | const i = propertySignatures.findIndex((ps) => ps.name === name) |
| 3281 | if (i === -1) { |
| 3282 | propertySignatures.push(ps) |
| 3283 | } else { |
| 3284 | const { isOptional, type } = propertySignatures[i] |
| 3285 | propertySignatures[i] = new AST.PropertySignature( |
| 3286 | name, |
| 3287 | extendAST(type, ps.type, path.concat(name)), |
| 3288 | isOptional, |
| 3289 | true |
| 3290 | ) |
| 3291 | } |
| 3292 | } |
| 3293 | return new AST.TypeLiteral( |
| 3294 | propertySignatures, |
| 3295 | x.indexSignatures.concat(y.indexSignatures) |
| 3296 | ) |
| 3297 | } |
| 3298 | throw new Error(errors_.getSchemaExtendErrorMessage(x, y, path)) |
| 3299 | } |
| 3300 | |
| 3301 | const preserveRefinementAnnotations = AST.omitAnnotations([AST.IdentifierAnnotationId]) |
| 3302 |
no test coverage detected
searching dependent graphs…