🔎 Search Terms
spread operator with expression
🕗 Version & Regression Information
⏯ Playground Link
No response
💻 Code
typeType={property: string,}lettypedVar1: Type={property: 'string',anotherProperty: 'foo',// TS-2353: Object literal may only specify known properties, and 'anotherProperty' does not exist in type 'Type'.}lettypedVar2: Type={property: 'string',
...({anotherProperty: 'bar'}),// No error}lettypedVar3: Type={property: 'string',anotherProperty: 'foo',// TS-2783: 'anotherProperty' is specified more than once, so this usage will be overwritten.
...({anotherProperty: 'bar'}),}lettypedVar4: Type={property: 'string',anotherProperty: 'foo',// No error, total ingoring
...(1==1&&{anotherProperty: 'bar'}),}console.log(typedVar2);// {"property": "string", "anotherProperty": "bar"} console.log(typedVar2.anotherProperty);// TS-2339 : Property 'anotherProperty' does not exist on type 'Type'.console.log(typedVar4);// {"property": "string", "anotherProperty": "bar"} console.log(typedVar4.anotherProperty);// TS-2339 : Property 'anotherProperty' does not exist on type 'Type'.🙁 Actual behavior
- TS-2353: Object literal may only specify known properties, and 'anotherProperty' does not exist in type 'Type'
- No error
- TS-2783: 'anotherProperty' is specified more than once, so this usage will be overwritten.
- No error
🙂 Expected behavior
- TS-2353: Object literal may only specify known properties, and 'anotherProperty' does not exist in type 'Type'
- TS-2353: Object literal may only specify known properties, and 'anotherProperty' does not exist in type 'Type'
- TS-2353 + TS-2783
- TS-2353 + TS-2783
Additional information about the issue
No response
🔎 Search Terms
spread operator with expression
🕗 Version & Regression Information
⏯ Playground Link
No response
💻 Code
🙁 Actual behavior
🙂 Expected behavior
Additional information about the issue
No response