Closed
Description
function onlyIdentity(id: <T>(x: T) => T) {
}
onlyIdentity((x) => x); // okay, as expected
onlyIdentity(<S>(x): S => x); // x gets inferred type "any"
It would be nice if the argument got the correct inferred type (S
) from it's context as an argument to onlyIdentity
.
In my use case, the return type is small and needs to be narrowed, so I want to specify it, but the argument types are very complex, so I'd prefer that they were inferred.