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
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
The text was updated successfully, but these errors were encountered:
Fixed by #42449
Sorry, something went wrong.
andrewbranch
No branches or pull requests
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
x
is{ value: B }
, whereB
is an unbound generic that leaked frombox
π Expected behavior
The type of
x
is{ value: number }
Related Issues
#31326, #31402
/cc @samholmes
The text was updated successfully, but these errors were encountered: