Open
Description
π Search Terms
type variable leak
π Version & Regression Information
This is the behavior in 5.8.3 and nightly build
β― Playground Link
π» Code
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
π 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