Skip to content

Commit 973ba8d

Browse files
authored
Merge pull request microsoft#28675 from Microsoft/revert-28528
Revert "Don't consider 'typeof a' as using 'a' (microsoft#28528)"
2 parents 6627d33 + f915420 commit 973ba8d

7 files changed

+2
-75
lines changed

src/compiler/checker.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ namespace ts {
14821482
// We just climbed up parents looking for the name, meaning that we started in a descendant node of `lastLocation`.
14831483
// If `result === lastSelfReferenceLocation.symbol`, that means that we are somewhere inside `lastSelfReferenceLocation` looking up a name, and resolving to `lastLocation` itself.
14841484
// That means that this is a self-reference of `lastLocation`, and shouldn't count this when considering whether `lastLocation` is used.
1485-
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol) && !isInTypeQuery(originalLocation!)) {
1485+
if (isUse && result && (!lastSelfReferenceLocation || result !== lastSelfReferenceLocation.symbol)) {
14861486
result.isReferenced! |= meaning;
14871487
}
14881488

@@ -19054,7 +19054,7 @@ namespace ts {
1905419054
}
1905519055

1905619056
function markPropertyAsReferenced(prop: Symbol, nodeForCheckWriteOnly: Node | undefined, isThisAccess: boolean) {
19057-
if (nodeForCheckWriteOnly && isInTypeQuery(nodeForCheckWriteOnly) || !(prop.flags & SymbolFlags.ClassMember) || !prop.valueDeclaration || !hasModifier(prop.valueDeclaration, ModifierFlags.Private)) {
19057+
if (!prop || !(prop.flags & SymbolFlags.ClassMember) || !prop.valueDeclaration || !hasModifier(prop.valueDeclaration, ModifierFlags.Private)) {
1905819058
return;
1905919059
}
1906019060
if (nodeForCheckWriteOnly && isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & SymbolFlags.SetAccessor && !(prop.flags & SymbolFlags.GetAccessor))) {

tests/baselines/reference/unusedParameterUsedInTypeOf.errors.txt

-9
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.errors.txt

-11
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.js

-14
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.symbols

-16
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.types

-16
This file was deleted.

tests/cases/compiler/unusedPropertyUsedInTypeOf.ts

-7
This file was deleted.

0 commit comments

Comments
 (0)