Commit 56578c5
committed
Fix compiler crash on generics overload resolution failure reported by #61524
Replace `Debug.fail()` calls with proper error generation to prevent TypeScript
compiler crashes when overload resolution fails for complex generic constraints,
for example JSX elements.
Problem
--
The TypeScript compiler crashes with "Debug Failure. No error for last overload
signature" when resolving certain complex generic constraints, e.g., JSX element
types. This regression has existed since TypeScript 3.6 and affects many React/JSX
projects.
Root Cause
--
When `getSignatureApplicabilityError()` returns no diagnostics for overload
candidates, the compiler calls `Debug.fail()` instead of handling the edge case
gracefully, causing an immediate crash.
Solution
--
- Replace `Debug.fail()` calls with fallback diagnostic generation
- Generate appropriate error messages for unhandled overload resolution cases
- Ensure compiler continues execution without crashing
Related to #61524, #60229, #48636, #33133
Signed-off-by: moznion <[email protected]>1 parent 2bc8933 commit 56578c5
1 file changed
+33
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36603 | 36603 | | |
36604 | 36604 | | |
36605 | 36605 | | |
36606 | | - | |
| 36606 | + | |
| 36607 | + | |
| 36608 | + | |
| 36609 | + | |
| 36610 | + | |
| 36611 | + | |
| 36612 | + | |
| 36613 | + | |
| 36614 | + | |
| 36615 | + | |
| 36616 | + | |
| 36617 | + | |
| 36618 | + | |
| 36619 | + | |
| 36620 | + | |
| 36621 | + | |
36607 | 36622 | | |
36608 | 36623 | | |
36609 | 36624 | | |
| |||
36624 | 36639 | | |
36625 | 36640 | | |
36626 | 36641 | | |
36627 | | - | |
| 36642 | + | |
| 36643 | + | |
| 36644 | + | |
| 36645 | + | |
| 36646 | + | |
| 36647 | + | |
| 36648 | + | |
| 36649 | + | |
| 36650 | + | |
| 36651 | + | |
| 36652 | + | |
| 36653 | + | |
| 36654 | + | |
| 36655 | + | |
| 36656 | + | |
| 36657 | + | |
| 36658 | + | |
36628 | 36659 | | |
36629 | 36660 | | |
36630 | 36661 | | |
| |||
0 commit comments