literal function with structure spread can't be rightly inferred in function's generic type slot #28816
Labels
Bug
A bug in TypeScript
Domain: Contextual Types
The issue relates to contextual types
Fix Available
A PR has been opened for this issue
Milestone
TypeScript Version: 3.2.1
Search Terms:
strucutre spread + generic
Code
Expected behavior:
newGetFoo and newGetFoo2 should have the same signature
Actual behavior:
newGetFoo
is:but
newGetFoo2
isPlayground Link:
http://www.typescriptlang.org/play/index.html#src=function%20id%3CT%3E(input%3A%20T)%3A%20T%20%7B%20return%20input%20%7D%0A%0Afunction%20getFoo%20(%7B%20foo%20%3D%2042%20%7D)%20%7B%0A%20%20return%20foo%0A%7D%0A%0Aconst%20newGetFoo%20%3D%20id(getFoo)%0Aconst%20newGetFoo2%20%3D%20id(function%20getFoo%20(%7B%20foo%20%3D%2042%20%7D)%20%7B%0A%20%20return%20foo%0A%7D)%0A
Related Issues:
The text was updated successfully, but these errors were encountered: