Skip to content

Commit 87521a0

Browse files
authored
fix(scope-manager): fix visiting TSAsExpression in assignment (typescript-eslint#3355)
1 parent ddfab95 commit 87521a0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,13 @@ function predicate(arg: any): asserts arg is T {
139139
throw 'oops';
140140
}
141141
}
142+
`,
143+
`
144+
interface ITest {
145+
attr: string;
146+
}
147+
let test: unknown;
148+
(test as ITest) = { attr: '' };
142149
`,
143150
{
144151
code: `

packages/scope-manager/src/referencer/Referencer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class Referencer extends Visitor {
320320
case AST_NODE_TYPES.TSAsExpression:
321321
case AST_NODE_TYPES.TSTypeAssertion:
322322
// explicitly visit the type annotation
323-
this.visit(left.typeAnnotation);
323+
this.visitType(left.typeAnnotation);
324324
// intentional fallthrough
325325
case AST_NODE_TYPES.TSNonNullExpression:
326326
// unwrap the expression

0 commit comments

Comments
 (0)
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