From e554378e37e39e024e2827c3fa65a5eae1f71bb1 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 000000000..3b7712145 --- /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 1475ae9b7..57b94d2a6 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.a) + `, + parser, + settings: { + 'import/parsers': { [parser]: ['.ts'] }, + 'import/resolver': { 'eslint-import-resolver-typescript': true }, + }, + }), + test({ code: `import { foobar } from "./typescript-declare-interface"`, parser,