mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
1de49ba369
The compiler has a translation mechanism to convert from an Angular `Type` to a `ts.TypeNode`, as appropriate. Prior to this change, it would translate certain Angular expressions into their value equivalent in TypeScript, instead of the correct type equivalent. This was possible as the `ExpressionVisitor` interface is not strictly typed, with `any`s being used for return values. For example, a literal object was translated into a `ts.ObjectLiteralExpression`, containing `ts.PropertyAssignment` nodes as its entries. This has worked without issues as their printed representation is identical, however it was incorrect from a semantic point of view. Instead, a `ts.TypeLiteralNode` is created with `ts.PropertySignature` as its members, which corresponds with the type declaration of an object literal. PR Close #34021