mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 21:36:50 -05:00
Consolidate type reference marking in getTypeFromTypeReference
This commit is contained in:
@@ -4961,6 +4961,10 @@ namespace ts {
|
||||
// type reference in checkTypeReferenceOrExpressionWithTypeArguments.
|
||||
links.resolvedSymbol = symbol;
|
||||
links.resolvedType = type;
|
||||
|
||||
if (noUnusedIdentifiers && symbol !== unknownSymbol && !isInAmbientContext(node)) {
|
||||
symbol.hasReference = true;
|
||||
}
|
||||
}
|
||||
return links.resolvedType;
|
||||
}
|
||||
@@ -8321,16 +8325,6 @@ namespace ts {
|
||||
return container === declarationContainer;
|
||||
}
|
||||
|
||||
function updateReferencesForInterfaceHeritiageClauseTargets(node: InterfaceDeclaration): void {
|
||||
const extendedTypeNode = getClassExtendsHeritageClauseElement(node);
|
||||
if (extendedTypeNode) {
|
||||
const t = getTypeFromTypeNode(extendedTypeNode);
|
||||
if (t !== unknownType && t.symbol && noUnusedIdentifiers && !isInAmbientContext(node)) {
|
||||
t.symbol.hasReference = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkIdentifier(node: Identifier): Type {
|
||||
const symbol = getResolvedSymbol(node);
|
||||
if (symbol && noUnusedIdentifiers && !isInAmbientContext(node)) {
|
||||
@@ -13620,9 +13614,6 @@ namespace ts {
|
||||
checkGrammarTypeArguments(node, node.typeArguments);
|
||||
const type = getTypeFromTypeReference(node);
|
||||
if (type !== unknownType) {
|
||||
if (type.symbol && noUnusedIdentifiers && !isInAmbientContext(node)) {
|
||||
type.symbol.hasReference = true;
|
||||
}
|
||||
if (node.typeArguments) {
|
||||
// Do type argument local checks only if referenced type is successfully resolved
|
||||
forEach(node.typeArguments, checkSourceElement);
|
||||
@@ -16099,7 +16090,6 @@ namespace ts {
|
||||
|
||||
if (produceDiagnostics) {
|
||||
checkTypeForDuplicateIndexSignatures(node);
|
||||
updateReferencesForInterfaceHeritiageClauseTargets(node);
|
||||
checkUnusedTypeParameters(node);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user