Skip to content

Empty object is not assignable to type argument with constrained index signature #6274

@tinganho

Description

@tinganho
interface B {
    [index: string]: string;
}
class A<T extends B> {
    a: T = {}; // Error
    b = {} as T; // No error
}

let b: B = {}; // No error

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