Skip to content

Incorrect inferring of return type  #31254

Closed
@cevek

Description

@cevek

Version: 3.4.5

declare function abc<T>(q: T | [{id: 'Id'}]): T 
var x = abc([{id: 'Id'}]).map(v => v.id /* 'Id' */) // string[] 

var y = abc([{id: 'Id'}]).map(v => v.id as 'Id') // 'Id'[]

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