You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tested with www.typescriptlang.org with versions from 3.3.3 to nightly (v5.4.0-dev.20240131)
β― 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
The text was updated successfully, but these errors were encountered:
le sigh... this error message really needs to be softened to make it more obvious EPC isn't a type check.
Count this as another vote for something like #55152 (comment)
π 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
The text was updated successfully, but these errors were encountered: