Skip to content

Property not found on index accessed type in a union #21464

Closed
@sandersn

Description

@sandersn
interface I {
    [key: string]: I
    (...args: any[]): I
}

declare let y: string | I
y.toUpperCase() // Error

Expected: No error: both string and I separately allow property access of toUpperCase.

Actual: Error, "Property 'toUpperCase' does not exist on type 'I'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions