Skip to content

no-duplicate-spread-property: only use properties matching contextual type if available #399

@ajafff

Description

@ajafff

Since microsoft/TypeScript#26798 there are no longer excess property errors for object spread.

declare let foo: {a: string, b: string};
let bar: {a: string} = {...foo, a: ''}; // error because the only meaningful property `a` of `...foo` is overridden, even if `c` is not overridden

With additional error reporting on spread without meaningful properties this could be used to implement #398

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions