-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this
Milestone
Description
Bug Report
Hi, we're trying to tighten up some of our code by using noUncheckedIndexedAccess. I know there are caveats to this compiler option which we've found by searching, but this one feels more like a bug?
🔎 Search Terms
Searched a variety of issues, the most relevant being: #13778
🕗 Version & Regression Information
4.5.4
⏯ Playground Link
💻 Code
enum Meat {
Sausage,
Bacon
}
const sausage = Meat.Sausage
const value = Meat[sausage] // string | undefined🙁 Actual behavior
value in the above example can't be undefined
🙂 Expected behavior
value to be typed as string, not string | undefined
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueHelp WantedYou can do thisYou can do this