Closed
Description
// foo.ts
export class Foo {
bar: string;
constructor(options: Foo.Options) {
this.bar = options.bar;
}
}
export namespace Foo {
export interface Options {
bar: string;
}
}
{
"parser": "@typescript-eslint/parser",
"plugins": ["import"],
"rules": {
"import/export": "error"
}
}
/tmp/test/foo.ts
1:14 error Multiple exports of name 'Foo' import/export
8:18 error Multiple exports of name 'Foo' import/export
✖ 2 problems (2 errors, 0 warnings)
TypeScript namespace merging should not be an error. This is similar to #1549, but that issue seems to be specific to default exports.
Activity
smac89 commentedon Sep 14, 2021
For me, the problem comes from doing something like:
The error is on the
parse
function inside the namespace even though it is being used in some other parts of the code.ljharb commentedon Sep 14, 2021
Setting aside that your example is biologically inaccurate, thanks for the additional reproduction code. I'd be happy to review a PR if someone has a solution.
namespace
usage results in false positive #2336export
: false positive for typescript namespace merging #2375[Fix] `export`: false positive for typescript namespace merging
Update dependency eslint-plugin-import to v2.26.0 (#1284)
httpete commentedon Jul 19, 2022
I am getting false positives as well, when exporting a type only export, it is being imported in another but it gets flagged.
ljharb commentedon Jul 19, 2022
@httpete if you're on the latest version of the plugin and still having problems, please file a new issue.