Skip to content
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

fix(scope-manager): fix visiting TSAsExpression in assignment #3355

Merged
merged 1 commit into from May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/eslint-plugin/tests/eslint-rules/no-undef.test.ts
Expand Up @@ -139,6 +139,13 @@ function predicate(arg: any): asserts arg is T {
throw 'oops';
}
}
`,
`
interface ITest {
attr: string;
}
let test: unknown;
(test as ITest) = { attr: '' };
`,
{
code: `
Expand Down
2 changes: 1 addition & 1 deletion packages/scope-manager/src/referencer/Referencer.ts
Expand Up @@ -320,7 +320,7 @@ class Referencer extends Visitor {
case AST_NODE_TYPES.TSAsExpression:
case AST_NODE_TYPES.TSTypeAssertion:
// explicitly visit the type annotation
this.visit(left.typeAnnotation);
this.visitType(left.typeAnnotation);
// intentional fallthrough
case AST_NODE_TYPES.TSNonNullExpression:
// unwrap the expression
Expand Down