Skip to content

property-will-be-overwritten-by-spread error is issued multiple times #37688

Open
@sandersn

Description

@sandersn
interface XX {
    paddingLeft: string;
}

declare var x: XX
declare function clonElement<Q>(props?: object): void;
clonElement({ style: {
    paddingLeft: 'hi',
    ...x
}})

Expected behavior:
One error on paddingLeft: 'hi': 'paddingLeft' is specified more than once, so this usage will be overwritten.

Actual behavior:
Two errors.

Our old commit of ant-design issues this error 8 times. This is probably just a result of (1) not caching the type from checking object literals (2) checking object literals multiple times during resolveCall.

Not high priority -- I'm not sure it's observable from VS Code -- and probably expensive to fix, depending on whether the reason that we decided to not cache object literal types is still true.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions