-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Type parameter leaks #19854
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
Comments
There is an error resolving the call for |
Shouldn't we fill in type parameters in |
it is an error.. what difference does it make really.. |
Due to return type inference, the erroneous type can occur arbitrarily far from the erroneous call site. A user won't know where to look first -- they'll just see |
Considering declare function first<T>(array: T[]): T;
function mkSkolem(x?: string[]) {
// @ts-ignore
return undefined! && first(x);
}
const skolemWitness = mkSkolem(undefined);
const val: typeof skolemWitness = 5; // should be an error |
|
Sure, |
It is.. there is an error! |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
#19620 will fix this. This was only a problem in services because we forgot to always fill in all the type arguments in the error case |
Fixed by #25100 |
TypeScript Version: 2.7.0-dev.20171108
Code
Expected behavior:
Type of
x
is{} | undefined
.Actual behavior:
Type of
x
isT | undefined
.The text was updated successfully, but these errors were encountered: