Skip to content

[export] “Multiple exports” false positive on merged class and namespace #1964

Closed
@andersk

Description

@andersk
// 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions