We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type variable leak
This is the behavior in 5.8.3 and nightly build
https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzCgggB4BBAGngCUA+AChwCMArALngG94APD+qBzIBKeAF5aNeAF8qsAOZDhHagChQkWAhTpseeAHcYUAA4kAGgz7xzyrrw7mZ68NDhI0mXPizASAFSsOfzt-AG5VVTA8AGcMeAgQKABrAEZxAiIIeiNTel9hKlTRAHoS+H8ATxMEADdYLCgmRISk5PgoVGB4HGBukBgYHBgo2PjElIAmDMJiHOMTfOBC+HSoGI7UStLyqpr4ephG5oQJ5NUgA
declare function call<A, R>(obj: { x: (a: A) => R }, arg: A): R declare function wrap<X>(x: X): { x: X } declare function id<T>(x: T): T; const leak1 = call(wrap(id), 1) // Type variable leak and odd error const leak2 = call(wrap(id), 1 as any) // Type variable leak
The type of the two variables is A, a leaked type variable.
A
No leaks.
No response
The text was updated successfully, but these errors were encountered:
ahejlsberg
Successfully merging a pull request may close this issue.
π Search Terms
type variable leak
π Version & Regression Information
This is the behavior in 5.8.3 and nightly build
β― Playground Link
https://www.typescriptlang.org/play/?#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzCgggB4BBAGngCUA+AChwCMArALngG94APD+qBzIBKeAF5aNeAF8qsAOZDhHagChQkWAhTpseeAHcYUAA4kAGgz7xzyrrw7mZ68NDhI0mXPizASAFSsOfzt-AG5VVTA8AGcMeAgQKABrAEZxAiIIeiNTel9hKlTRAHoS+H8ATxMEADdYLCgmRISk5PgoVGB4HGBukBgYHBgo2PjElIAmDMJiHOMTfOBC+HSoGI7UStLyqpr4ephG5oQJ5NUgA
π» Code
π Actual behavior
The type of the two variables is
A
, a leaked type variable.π Expected behavior
No leaks.
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: