| 2108 | * @since 3.10.0 |
| 2109 | */ |
| 2110 | export const annotations = (ast: AST, overrides: Annotations): AST => { |
| 2111 | const d = Object.getOwnPropertyDescriptors(ast) |
| 2112 | const base: any = { ...ast.annotations } |
| 2113 | delete base[IdentifierAnnotationId] |
| 2114 | const value = { ...base, ...overrides } |
| 2115 | const surrogate = getSurrogateAnnotation(ast) |
| 2116 | if (Option.isSome(surrogate)) { |
| 2117 | value[SurrogateAnnotationId] = annotations(surrogate.value, overrides) |
| 2118 | } |
| 2119 | d.annotations.value = value |
| 2120 | return Object.create(Object.getPrototypeOf(ast), d) |
| 2121 | } |
| 2122 | |
| 2123 | /** |
| 2124 | * Equivalent at runtime to the TypeScript type-level `keyof` operator. |