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
Since microsoft/TypeScript#26798 there are no longer excess property errors for object spread. That also means you can spread anything, even if it doesn't have any property in common with the contextual type.
declareletfoo: {a: string,b: string};letbar: {c: string}={...foo,c: ''};// spreading `...foo` doesn't contribute any useful properties to `bar`letfoobar: {a: string,c: string}={...foo,c: ''};// this is valid because there is at least one overlapping propertyletbaz={...foo,c: ''};// this is valid because there is no contextual typeletbas: Record<string,string>={...foo,c: ''};// this is valid because of the index signature
I have no strong opinion whether this should be a new rule or integrated into an existing rule.
For a reference implementation regarding object spread, see no-duplicate-spread-property
The text was updated successfully, but these errors were encountered:
Since microsoft/TypeScript#26798 there are no longer excess property errors for object spread. That also means you can spread anything, even if it doesn't have any property in common with the contextual type.
I have no strong opinion whether this should be a new rule or integrated into an existing rule.
For a reference implementation regarding object spread, see
no-duplicate-spread-property
The text was updated successfully, but these errors were encountered: