-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
generic type deduction affected by unrelated factors #26946
Comments
I believe this is a design limitation. TypeScript's heuristic is that a fresh literal type (here |
@mattmccutchen Thank you for the workaround. |
What I believe is happening is that the candidate |
This is a duplicate of #25215. As @mattmccutchen explains above, the issue is that the type FunctionPropertyNames<T> = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T] & string; |
TypeScript Version: 3.1.0-dev.201808331
Search Terms: generic type deduction
The generic type deduction does something odd. The type deduction should not be affected by extends like it does in this example. Also type "magic" also affects the behavior while all the parts do what they suppose to do.
Code
Expected behavior:
k1 should be Result<"foo">
Actual behavior:
k1 deduced to be Result<"foo" | "bar">
Playground Link:
Playground Link
Related Issues:
The text was updated successfully, but these errors were encountered: