Skip to content

2.0: Type guards not working inside callbacks #7719

Closed
@jeffreymorlan

Description

@jeffreymorlan
function f(x: {}) {
    if (typeof x === 'string') {
        x.charAt(0); // OK
        [1, 2].map(i => x.charAt(i)); // OK in 1.8, error in current master
    }
}

This appears to have started with commit dad0564

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions