Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

export enum doesn’t register as an export #345

Closed
j-f1 opened this issue Aug 7, 2017 · 0 comments · Fixed by #364
Closed

export enum doesn’t register as an export #345

j-f1 opened this issue Aug 7, 2017 · 0 comments · Fixed by #364
Labels

Comments

@j-f1
Copy link
Contributor

j-f1 commented Aug 7, 2017

What version of TypeScript are you using?
2.3.4

What version of typescript-eslint-parser are you using?
4.0.0

What code were you trying to parse?

// foo.ts
export enum Foo {
  Bar,
  Baz,
}
// bar.ts
/* eslint "import/named": "error" */
import { Foo } from './foo'

What did you expect to happen?
No errors — Foo is exported in foo.ts, and it’s imported in bar.ts

What happened?

Foo not found in './foo.ts' (import/named)

It looks like this should be parsed as

ExportNamedDeclaration {
  // ...
  declaration: TSEnumDeclaration
  // ...
}

instead of

TSEnumDeclaration {
  // ...
  modifiers: [
    TSExportKeyword
  ]
  // ...
}

Also, the TSEnumDeclaration node should have the name property aliased to id so it’s compatible with ClassDeclaration nodes.

j-f1 added a commit to j-f1/forked-typescript-eslint-parser that referenced this issue Aug 19, 2017
• set the `id` for compatibility with class declarations
• wrap the node in an ExportNamedDeclaration if the enum is exported
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants