We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
unbound type parameter generic leak
This is the behavior in every version I tried, and I reviewed the FAQ
Workbench Repro
// @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
The type of x is { value: B }, where B is an unbound generic that leaked from box
x
{ value: B }
B
box
The type of x is { value: number }
{ value: number }
#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