Check truthy/falsy-ness for non-primitives to identify unreachable code #44840
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Experimentation Needed
Someone needs to try this out to see what happens
Suggestion
An idea for TypeScript
Suggestion
In some cases TypeScript can identify unreachable code and throws an error:
In other cases it is currently not possible, but it would be very helpful. (Maybe even with a suggestion what could have been meant - see array example.)
🔍 Search Terms
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Throw errors on unreachable code examples.
📃 Motivating Example
This week I saw a colleague which could have found a bug way sooner by introducing such a check. ❤️
💻 Use Cases
Finding bugs.
The text was updated successfully, but these errors were encountered: