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
record destructuring concat
TypeScript 5.2
https://www.typescriptlang.org/play?ssl=5&ssc=1&pln=5&pc=57#code/MYewdgzgLgBAhgLhgJQKagE4BMA80MCWYA5gDTxgCeAfDALwwDe8SATOQEZIDMMAvgG4AUKEiwO9JjAB0suOQBebfsJHhoMSkjSZc+ImQo1JzRDHYwuMXoLViYCyQHkOAK3RRpcCBALEwABQu7sCe3r7+AYx85JQAlOTMSub8cQJAA
const a: Record<string, any> = { a: 2, b: 3 }; const b = { ...a, z: 2 }; const y: Record<string, any> = { a: 2, b: 3 }; const z = Object.assign(Object.assign({}, y), { z: 2 });
b is of type { z: number}
b
{ z: number}
b should be of type:
Record<string, any> & { z: number; }
Same as the type of z
z
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #27273. Also this is a spread, not a destructuring.
Sorry, something went wrong.
Note that itβs not actually an βinvalid typeβ - { z: number } is a valid description of what you get, just not the most convenient.
{ z: number }
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.
No branches or pull requests
π Search Terms
record destructuring concat
π Version & Regression Information
TypeScript 5.2
β― Playground Link
https://www.typescriptlang.org/play?ssl=5&ssc=1&pln=5&pc=57#code/MYewdgzgLgBAhgLhgJQKagE4BMA80MCWYA5gDTxgCeAfDALwwDe8SATOQEZIDMMAvgG4AUKEiwO9JjAB0suOQBebfsJHhoMSkjSZc+ImQo1JzRDHYwuMXoLViYCyQHkOAK3RRpcCBALEwABQu7sCe3r7+AYx85JQAlOTMSub8cQJAA
π» Code
π Actual behavior
b
is of type{ z: number}
π Expected behavior
b
should be of type:Same as the type of
z
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: