Skip to content

type checking after instainceOf condition is working incorrectly #5522

Closed
@stepancar

Description

@stepancar

this example works great

function test(value: string[]| string){
    var result: string;
    if (value instanceof Array){
        result = value.join('');
    }
}

but this

interface IFoo {
    value: string[] | string;
}

function bar(options: IFoo) {
    var result: string;
    if (options.value instanceof Array) {
        result = options.value.join('')
    }
}

property join does not exists on type string[] | string

i think i'ts compiler mistake

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