-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
callable(T): T
doesn't preserve argument types on return types after invocation
#10549
Comments
After the review, it looks to be not a bug, thanks |
But are there any nice workaround for this? |
Possibly equivalent in TypeScript: interface iface {
foo: number
}
class Impl implements iface {
public foo = 1;
}
function check(fn: <T extends iface>(input: T) => T): void {
const input = new Impl;
// ^? const input: Impl
const output = fn(input);
// ^? const output: Impl
} The point of view is Generic parameters for callable |
With this signature:
You're making the function |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug report
The following simple snippet works:
But the following doesn't work:
Code snippet that reproduces the problem
https://phpstan.org/r/552156a3-7933-43b9-9d56-076043d96034
Expected output
Did PHPStan help you today? Did it make you happy in any way?
Everyday it helps our teams! Thank you
The text was updated successfully, but these errors were encountered: