From cc1ca22b0ecbe4bad213421932c6f6b7aa4c98bb Mon Sep 17 00:00:00 2001 From: L Lllvvuu Date: Fri, 18 Aug 2023 22:13:54 -0700 Subject: [PATCH] test: failing case for shadowed namespace in .d.ts --- .../typescript-declare-nested-shadowed.d.ts | 16 ++++++++++++++++ tests/src/rules/namespace.js | 12 ++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/files/typescript-declare-nested-shadowed.d.ts diff --git a/tests/files/typescript-declare-nested-shadowed.d.ts b/tests/files/typescript-declare-nested-shadowed.d.ts new file mode 100644 index 0000000000..3b7712145a --- /dev/null +++ b/tests/files/typescript-declare-nested-shadowed.d.ts @@ -0,0 +1,16 @@ +declare namespace foo { + interface SomeInterface { + a: string; + } +} + +declare namespace foo.bar { + interface SomeOtherInterface { + b: string; + } + + function MyFunction(); +} + +declare const foo: foo.SomeInterface; +export = foo; diff --git a/tests/src/rules/namespace.js b/tests/src/rules/namespace.js index 1475ae9b7d..cab3674224 100644 --- a/tests/src/rules/namespace.js +++ b/tests/src/rules/namespace.js @@ -156,6 +156,18 @@ const valid = [ }, }), + test({ + code: ` + import * as foo from "./typescript-declare-nested-shadowed" + console.log(foo.c) + `, + parser, + settings: { + 'import/parsers': { [parser]: ['.ts'] }, + 'import/resolver': { 'eslint-import-resolver-typescript': true }, + }, + }), + test({ code: `import { foobar } from "./typescript-declare-interface"`, parser,