We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
types typescript, spread operator
in all version typscript
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAZgSwE7RgXhgbwLACgYEwCGA5gKYBcMATNXgL556iSxFU76FhEC2lMaEgRgSDdFjyEYAOjmIUUADRTufAQHIiYAF4gkGhkA
const first = { age: 22 }
const a: { name: string } = { ...first, name: 'anzor' }
the compiler does not cause an error in the second object type
the ts compiler should warn about the type mismatch
No response
The text was updated successfully, but these errors were encountered:
Duplicate of #39998. Excess property checks are not performed when spreading.
There is no type mismatch. Additional properties are allowed to exist on objects.
Sorry, something went wrong.
Duplicate of #39998. Excess property checks are not performed when spreading. There is no type mismatch. Additional properties are allowed to exist on objects.
How can this be defeated??????????
It's a fundamental part of TypeScripts type system, it's intentional.
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
types typescript, spread operator
π Version & Regression Information
in all version typscript
β― Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAZgSwE7RgXhgbwLACgYEwCGA5gKYBcMATNXgL556iSxFU76FhEC2lMaEgRgSDdFjyEYAOjmIUUADRTufAQHIiYAF4gkGhkA
π» Code
const first = {
age: 22
}
const a: {
name: string
} = {
...first,
name: 'anzor'
}
π Actual behavior
the compiler does not cause an error in the second object type
π Expected behavior
the ts compiler should warn about the type mismatch
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: