Skip to content

Commit

Permalink
fix: #2526
Browse files Browse the repository at this point in the history
  • Loading branch information
dinofx committed Sep 10, 2020
1 parent 19516de commit 90b431a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/eslint-plugin/tests/rules/no-shadow.test.ts
Expand Up @@ -11,6 +11,14 @@ const ruleTester = new RuleTester({

ruleTester.run('no-shadow TS tests', rule, {
valid: [
// nested conditional types
`
export type ArrayInput<Func> = Func extends (arg0: Array<infer T>) => any
? T[]
: Func extends (...args: infer T) => any
? T
: never;
`,
`
function foo() {
var Object = 0;
Expand Down
4 changes: 3 additions & 1 deletion packages/scope-manager/src/referencer/TypeVisitor.ts
Expand Up @@ -94,9 +94,11 @@ class TypeVisitor extends Visitor {
// which are only accessible from inside the conditional parameter
this.#referencer.scopeManager.nestConditionalTypeScope(node);

this.visitChildren(node);
this.visitChildren(node, ['falseType']);

this.#referencer.close(node);

this.visit(node.falseType);
}

protected TSConstructorType(node: TSESTree.TSConstructorType): void {
Expand Down

0 comments on commit 90b431a

Please sign in to comment.