Skip to content

instanceof bug with condition #20393

Closed
Closed
@cevek

Description

@cevek

TypeScript Version: 2.6.1

Code

interface Foo {
    bar: Bar;
}
interface Bar {
    baz: number;
}

function abc(foo: Foo) {
    if (foo.bar instanceof Array) {
        abc(foo.bar[0]); // no error
    }   else {
       abc(foo.bar); // no error
    }
    
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions