Skip to content

3.9 regression: bogus property-will-be-overwritten-by-spread errors #36779

Closed
@sandersn

Description

@sandersn
export class Terror extends Error {
    public get telemetry() {
        return { command: "bye", ok: "next" }
    }
}
function g(u: unknown, b: boolean, t: Terror) {
    return { command: "hi", ...(b ? t.telemetry : {}) }
}

Expected behavior:

No error; command is not necessarily overwritten, for example when b=false.

Actual behavior:

Error: 'command' is specified more than once, so this usage will be overwritten.

User tests vscode and office-fabric-ui have failures because of this.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions