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
Another issue elated to #44421. This one seems to be more problematic due to runtime unsoundness.
strict optional properties, object spread, undefined
Nightly, with strictOptionalProperties on
Playground link with relevant code
var a: {a: string} = {a: ''} var b: {a?: string} = {} var c: {a: string | undefined} = {a: undefined} var d: {a?: string | undefined} = {a: undefined} var a1 = {a: 123, ...a} // error: "a" specified more than once var b1 = {a: 123, ...b} // {a: number|string} var c1 = {a: 123, ...c} // expect error "a" specified more than once var d1 = {a: 123, ...d} // expect {a: string|number|undefined} d1.a.toString() // crash! should report error
c1 created without duplicate property error and d1 is inferred as {a: string | number}
c1
d1
{a: string | number}
TS should report error on c1 and d1 should be inferred as {a: string|number|undefined} to prevent runtime crash.
{a: string|number|undefined}
The text was updated successfully, but these errors were encountered:
ahejlsberg
Successfully merging a pull request may close this issue.
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Another issue elated to #44421. This one seems to be more problematic due to runtime unsoundness.
🔎 Search Terms
strict optional properties, object spread, undefined
🕗 Version & Regression Information
Nightly, with strictOptionalProperties on
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
c1
created without duplicate property error andd1
is inferred as{a: string | number}
🙂 Expected behavior
TS should report error on
c1
andd1
should be inferred as{a: string|number|undefined}
to prevent runtime crash.The text was updated successfully, but these errors were encountered: