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
Playground link with relevant code
class Test{get Length(){return 1;}} function spread<T> (t: T) { return {... t} } let test1 = {...new Test()}; console.log(test1.Length); // Expected: throws error. Actual: throws error. let test2 = (o => ({...o}))(new Test()); console.log(test2.Length); // Expected: throws error. Actual: throws error. let test3 = spread(new Test()); console.log(test3.Length); // Expected: throws error. Actual: doesn't throw error.
Doesn't throw compile-time error. Error is at runtime, the spread operator of Test does not copy over properties.
Typescript's type system should figure out that the type is not T but instead is just enumerable properties of T.
The text was updated successfully, but these errors were encountered:
See #9726
Sorry, something went wrong.
No branches or pull requests
Bug Report
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Doesn't throw compile-time error.
Error is at runtime, the spread operator of Test does not copy over properties.
🙂 Expected behavior
Typescript's type system should figure out that the type is not T but instead is just enumerable properties of T.
The text was updated successfully, but these errors were encountered: