-
-
Notifications
You must be signed in to change notification settings - Fork 159
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
When trying to use ts-pattern to match cases to a string type union (eg, 'case-1' | 'case-2'), the syntax is unnecessarily verbose. I need to write () => every time, and then also add as const after each value, or repeat the options in returnType<...>() to get a proper type out
Describe the solution you'd like
It would be nice if the types for handlers accepted either a function with a given return type OR a value with that type, in the case where no data from the matcher is needed, and thus ts-pattern would have access to the specific value instead of just string to determine its returnType implicitly.
Add any other context or screenshots about the feature request here.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request