mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Resolve the decorator type as type and check if the symbol has value.
This would make sure we are referencing correct symbol to check if it has value Fixes #4239
This commit is contained in:
parent
8ad9138828
commit
345de8fca5
@ -11384,9 +11384,16 @@ namespace ts {
|
||||
// serialize the type metadata.
|
||||
if (node && node.kind === SyntaxKind.TypeReference) {
|
||||
let root = getFirstIdentifier((<TypeReferenceNode>node).typeName);
|
||||
let rootSymbol = resolveName(root, root.text, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias && !isInTypeQuery(node) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
|
||||
markAliasSymbolAsReferenced(rootSymbol);
|
||||
var meaning = root.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace;
|
||||
// Resolve type so we know which symbol is referenced
|
||||
let rootSymbol = resolveName(root, root.text, meaning | SymbolFlags.Alias, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined);
|
||||
// Resolved symbol is alias
|
||||
if (rootSymbol && rootSymbol.flags & SymbolFlags.Alias) {
|
||||
let aliasTarget = resolveAlias(rootSymbol);
|
||||
// If alias has value symbol - mark alias as referenced
|
||||
if (aliasTarget.flags & SymbolFlags.Value && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) {
|
||||
markAliasSymbolAsReferenced(rootSymbol);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,6 +34,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var service_1 = require("./service");
|
||||
var MyComponent = (function () {
|
||||
function MyComponent(Service) {
|
||||
this.Service = Service;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user