Skip to content

And expression inferrs wrong type. #26468

Closed
@dbaeumer

Description

@dbaeumer

TypeScript Version: 3.1.0-dev.201xxxxx

Search Terms:

Code

let b: boolean;
let s: string;

let x = b && s;

Expected behavior:

The inferred type of x is boolean | string;

Actual behavior:

The inferred type of x is string;

Playground Link:

https://www.typescriptlang.org/play/#src=let%20b%3A%20boolean%3B%0D%0Alet%20s%3A%20string%3B%0D%0A%0D%0Alet%20x%20%3D%20b%20%26%26%20s%3B

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking ChangeWould introduce errors in existing codeBugA bug in TypeScriptWon't FixThe severity and priority of this issue do not warrant the time or complexity needed to fix it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions