Open webstrand opened 1 day ago
I believe that at the implementation level the difference boils down to this line of code: https://github.dev/microsoft/TypeScript/blob/d85767abfd83880cea17cea70f9913e9c4496dcc/src/compiler/checker.ts#L35096
In the case that doesn't work a fixing mapper is used and that prevents inference candidates that are discovered later from being chosen.
🔎 Search Terms
generic function spread regression inference
🕗 Version & Regression Information
⏯ Playground Link
https://www.typescriptlang.org/play/?ts=5.8.0-dev.20241121#code/KYDwDg9gTgLgBDAnmYcByEAmqC8cDecAvgNwBQZ2AxgDYCGUwAkAGYCuAdlTAJYQdwWEYSIgAeACoAaOACVgAZzY14oGMA6YFcAIJQodRABkeAa2BjOpjhADuHAHwyAogDceNOGo1a4jOpj8NIhwVjb2ANoAug4AFGRMPBxgbDAAXHDSCVR0NDQARnRUphmxSSnpmTJgjK4Z8koqMgB0rcDuNBluHgCUcDgOcorKMFJkPfXDKhTU9IysnNx8AoV0a2tQkjINI14g6praegbGZhZhdo5xCeWpGVlMOXmFxaW3ldJwNe2TjTB9AyGfzGEyBIxmwFoDFQ7C4vH4cCeBSKpkk1zgGLg73uY0xX1qGQUMCgSQA5tEQYTiWTouQyKBILBBIt4QJQHQALZgGgWCRxbGZPr4Ch4gD0orgAEkOCxgFBtEgUF8GJzgOooGCVIjoIxuMEEkJRMIyslUjIkS9TD1yGKJQA9AD8Isx4rgADE6B4FRAsTK5QhkKgwCqOWr-TstVQdZCYMFfUTgAFfbL5QgABaoKMcIkGJIwBKrdYME0Vc25ZHFa1kW1wR3OjGugBCyDoCgUZOTco0VGAMhgGeZcOWiPLWO0Uf0MermML602nxzNJiJbNI+eKKr04bEulKYVgeVBlD6s18AnutjiC3cFnGxXozXFdRfKrNbrRDIQA
💻 Code
🙁 Actual behavior
baaaaaar(input, callback)
infers the constraint ofResult = ArrayLike<unknown>
🙂 Expected behavior
baaaaaar(input, callback)
should inferResult = string[]
from the return type or parameter ofcallback
.Additional information about the issue
No response