Previously, TypeScript would resolve the reified types for the `design:types` decorator emit in the regular `currentScope`. That scope does not include class declaration bodies. However when reifying types, class declarations do introduce a new scope for any `TypeVariable`s declared on them. Because TS resolved the EntityName for such types against the parent scope (e.g. the source file), not the class scope, TypeScript would either fail to resolve the type (giving `TypeReferenceSerializationKind.Unknown`), or incorrectly resolve to a different, accidentally matching symbol in the outer scope (giving `TypeWithConstructSignatureAndValue`). This would result in an emit referencing an undeclared symbol, or mis-referencing the wrong symbol. __metadata("design:type", typeof (_a = typeof TypeVariable !== "undefined" && TypeVariable) === "function" && _a || Object) __metadata("design:type", TypeVariable) This change special cases `currentScope` for `serializeTypeReferenceNode` to use a class scope, if present. This changes the emit for a `TypeVariable` back to `Object`: __metadata("design:type", Object)
8 lines
135 B
TypeScript
8 lines
135 B
TypeScript
// @experimentalDecorators: true
|
|
// @emitDecoratorMetadata: true
|
|
|
|
export class C<TypeVariable> {
|
|
@Decorate
|
|
member: TypeVariable;
|
|
}
|