Skip to content

Commit 1f34a4e

Browse files
committed
Revert "Don't consider 'typeof a' as using 'a' (#28528)"
This reverts commit 0c4ceee.
1 parent 21965c1 commit 1f34a4e

File tree

7 files changed

+2
-75
lines changed

7 files changed

+2
-75
lines changed

src/compiler/checker.ts

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

@@ -19055,7 +19055,7 @@ namespace ts {
1905519055
}
1905619056

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

tests/baselines/reference/unusedParameterUsedInTypeOf.errors.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.errors.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.symbols

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/baselines/reference/unusedPropertyUsedInTypeOf.types

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/cases/compiler/unusedPropertyUsedInTypeOf.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)