GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Allow enums in local scopes · Issue #3217 · microsoft/TypeScript Closed Labels CommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript Milestone DescriptionCurrently the following is allowed: enum Color { red, green, blue } function fun(myColor) { if (myColor == Color.red) { console.log("awesome"); } else { console.log("bummer"); } } This compiles, but gives a warning: function fun(myColor) { enum Color { red, green, blue } // Warning "Statement expected" if (myColor == Color.red) { console.log("awesome"); } else { console.log("bummer"); } } Especially when refactoring existing JavaScript code, there are cases where an enum would be useful, but wouldn't be used outside of a single function. In those cases, I think it makes sense to allow the enum to be defined inside of the function's scope. Activity
MetadataMetadataAssigneesLabelsCommittedThe team has roadmapped this issueThe team has roadmapped this issueFixedA PR has been merged for this issueA PR has been merged for this issueSuggestionAn idea for TypeScriptAn idea for TypeScript TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |