Skip to content

2.1 Regression: (A | undefined) & B is possibly undefined #12354

Closed
@jods4

Description

@jods4

TypeScript Version: 2.1.? / as shipped with VS 2017 RC

Code

let x: { id: number } | undefined;
let y: { id: number };
x = Object.assign(y, x);
x.id;

Expected behavior: x.id was fine in TS 2.0, and should be as it is guaranteed to be x === y.

Actual behavior: x.id triggers x is possibly undefined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions