Support inferring never
as the return type in JavaScript when overriding a class method that returns never
#46791
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Has Repro
This issue has compiler-backed repros: https://aka.ms/ts-repros
Suggestion
An idea for TypeScript
Suggestion
🔍 Search Terms
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
When implementing an abstract method with a signature that returns
never
, the concrete implementation should have its return type inferred asnever
if the method body contains an explicitthrow
and noreturn
statements including the implicitreturn
.📃 Motivating Example
Workbench Repro:
💻 Use Cases
To get better type inference while working on engine262’s parser.
Relevant issues
The text was updated successfully, but these errors were encountered: