Skip to content

Create type aliases for unresolved type symbols #45976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 23, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Unresolved import aliases create tagged unresolved symbols
  • Loading branch information
ahejlsberg committed Sep 21, 2021
commit 8f828c46c8fa085262ecd906614625c448326028
8 changes: 5 additions & 3 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13190,7 +13190,9 @@ namespace ts {
if (!name) {
return unknownSymbol;
}
return resolveEntityName(name, meaning, ignoreErrors) || (ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name));
const symbol = resolveEntityName(name, meaning, ignoreErrors);
return symbol && symbol !== unknownSymbol ? symbol :
ignoreErrors ? unknownSymbol : getUnresolvedSymbolForEntityName(name);
}

function getTypeReferenceType(node: NodeWithTypeArguments, symbol: Symbol): Type {
Expand Down Expand Up @@ -40221,8 +40223,8 @@ namespace ts {
}
else if (isTypeReferenceIdentifier(name as EntityName)) {
const meaning = name.parent.kind === SyntaxKind.TypeReference ? SymbolFlags.Type : SymbolFlags.Namespace;
return resolveEntityName(name as EntityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true) ||
getUnresolvedSymbolForEntityName(name as EntityName);
const symbol = resolveEntityName(name as EntityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name as EntityName);
}
if (name.parent.kind === SyntaxKind.TypePredicate) {
return resolveEntityName(name as Identifier, /*meaning*/ SymbolFlags.FunctionScopedVariable);
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy