Skip to content

No contextual typing for interfaces that extends interface with index signature #3804

Closed
@tinganho

Description

@tinganho

I was hoping this could work:

class A {
    public a: string;
}

interface B {
    [index: string]: A;
}

interface C extends B {
    a;
    b;
    c;
}

let c: C;
c.a.a // c.a of type A

but members of interface C has type any instead I was hoping I could get type A?

Notice I don't want to define directly:

let c: B;

because I need to pass C as a type with defined props.

Metadata

Metadata

Assignees

No one assigned

    Labels

    By DesignDeprecated - use "Working as Intended" or "Design Limitation" instead

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions