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,