You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Function lacks ending return statement and return type does not include 'undefined'.
π Expected behavior
The exhaustiveness check should understand that there is no missing case to handle, so the default case should be optional.
Additional information about the issue
It's the companion issue for PR #60644 that will fix this if merged.
The text was updated successfully, but these errors were encountered:
jfet97
changed the title
sSwitch statements exhaustiveness check is failing when the expression has generic type but with literal type constraint
Switch statements exhaustiveness check is failing when the expression has generic type but with literal type constraint
Dec 2, 2024
π Search Terms
switch exhaustiveness literals
π Version & Regression Information
This is mostly related with the new capabilities from #56941, so I'd say TS 5.8.
β― Playground Link
https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241202#code/C4TwDgpgBACghiANgezgEygXgFBSgHygG8oB9YOAcwC4oAiOAV2AAs6BuKRgZwgCcAdnAC2EWt2B8AlgMqcwcbtwDuyPmnGSZlKAF9cBYmQo16AYzh9gHKFOARh3WgEE+fBAB4SUjVAnTZTgBHRjgBYDsQWgFGYQAjfj0APj0DQhJyKlo6SD5uZAEbIVFNALkoKjEoGPjE3XZsbFBIWAQUdABhAvtwrGIDAG0YWwFWpFQMRVgBukzKOgBdBdoAeWE7DxgAGno5uiSG+saAM0YBMwiCqGFkMwBreHH0TdIAFWcAcSgIAA8etG4Y3aaBmewWSQAFAZ-LQYG9PltsABKWFtCZdcIQcJDeEfBb9PAqOxmFhQCH+JEEvBQCy8ehMVh0agGalQPgQYCMQRGHj8YpVOj2CR0HYKJSqdTZdDrQp6Bqs2nQOgWKxMlnU9mc7neeyOWgDby+OgARgATABmEVQEJhCKgWhm816fFHBWKJW5fKFZmsvCarmjEj8qUCNDsuBWyq0U0Adjl6oA9AmoGgIMcmIhgD7fUmoKw+MhlNUIEWAKJuNQQuhnO4CQujEx0JHy1K6IA
π» Code
π Actual behavior
Error: Function lacks ending return statement and return type does not include
'undefined'
.π Expected behavior
The exhaustiveness check should understand that there is no missing case to handle, so the
default
case should be optional.Additional information about the issue
It's the companion issue for PR #60644 that will fix this if merged.
The text was updated successfully, but these errors were encountered: