Bug Report
π Search Terms
unbound type parameter generic leak
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
Workbench Repro
π» Code
// @declaration
export const obj = <A,>(shape: { [K in keyof A]: A[K] }) => shape
// .d.ts shows correct type
export const box = <B,>(t: B) => obj({ value: t });
// ^?
// Type looks correct
// .d.ts shows const x: { value: B }
export const x = box(5)
// ^?
// Shows unbound B
// .d.ts shows const x: { value: B }
export const y = x
// ^?
// Shows unbound B
// .d.ts shows type U = typeof x.value
export type U = typeof x.value
// ^?
// Shows unbound B
π Actual behavior
The type of x is { value: B }, where B is an unbound generic that leaked from box
π Expected behavior
The type of x is { value: number }
Related Issues
#31326, #31402
/cc @samholmes
Bug Report
π Search Terms
unbound type parameter generic leak
π Version & Regression Information
This is the behavior in every version I tried, and I reviewed the FAQ
β― Playground Link
Workbench Repro
π» Code
π Actual behavior
The type of
xis{ value: B }, whereBis an unbound generic that leaked fromboxπ Expected behavior
The type of
xis{ value: number }Related Issues
#31326, #31402
/cc @samholmes