microsoft / microsoft/TypeScript
Enum redeclared as var inside block scope
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: TS Playground as of 2019-03-25
Search Terms: enum declarations can only merge, enum block scope, enum redeclaration
Code
{ enum Foo { } var Foo }
enum Bar { } var Bar;
Expected behavior:
They should both error, or they should be both accepted
Actual behavior:
Only Bar is an error
Related Issues:
Found while fixing https://github.com/babel/babel/issues/9763
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two enum-and-var examples in the linked TypeScript Playground and compare the block-scoped case with the top-level case. Trace the compiler's declaration checks for these snippets and determine the consistent behavior expected for both; done means the two cases agree and the reported regression is covered by an appropriate compiler test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100