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

no-shadow if const and enum value are the same #552

Closed
samijaber opened this issue Nov 16, 2018 · 1 comment
Closed

no-shadow if const and enum value are the same #552

samijaber opened this issue Nov 16, 2018 · 1 comment
Labels

Comments

@samijaber
Copy link

What version of TypeScript are you using?
3.1.6

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

What code were you trying to parse?

const f = 0;
enum Foo {
  f,
}

What did you expect to happen?
No errors

What happened?
Got a no-shadow error

Might be somewhat related to #459

@mysticatea
Copy link
Member

Thank you for this report.

However, this is an expected behavior because the enum member f literally shadows the upper f.

const f = 777;
enum E1 {
    f = 1, // Shadows the upper `f`.
    g = f, // = 1
}
enum E2 {
    f1 = 1,
    g = f, // This is the upper `f`.
}

Open playground

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants