In JSDoc, resolve import types as values too (#26066)

* In JSDoc, resolve import types as values too

This is something that we probably should have been doing for some time.
Fixes #26049

* Fix whitespace lint
This commit is contained in:
Nathan Shively-Sanders
2018-07-31 11:07:06 -07:00
committed by GitHub
parent 4bc7f1570b
commit a21ac11582
4 changed files with 98 additions and 2 deletions
+2 -2
View File
@@ -8189,7 +8189,7 @@ namespace ts {
}
function isJSDocTypeReference(node: Node): node is TypeReferenceNode {
return !!(node.flags & NodeFlags.JSDoc) && node.kind === SyntaxKind.TypeReference;
return !!(node.flags & NodeFlags.JSDoc) && (node.kind === SyntaxKind.TypeReference || node.kind === SyntaxKind.ImportType);
}
function checkNoTypeArguments(node: NodeWithTypeArguments, symbol?: Symbol) {
@@ -9462,7 +9462,7 @@ namespace ts {
links.resolvedSymbol = unknownSymbol;
return links.resolvedType = errorType;
}
const targetMeaning = node.isTypeOf ? SymbolFlags.Value : SymbolFlags.Type;
const targetMeaning = node.isTypeOf ? SymbolFlags.Value : node.flags & NodeFlags.JSDoc ? SymbolFlags.Value | SymbolFlags.Type : SymbolFlags.Type;
// TODO: Future work: support unions/generics/whatever via a deferred import-type
const innerModuleSymbol = resolveExternalModuleName(node, node.argument.literal);
if (!innerModuleSymbol) {