Skip to content

Class ambient declaration should not require redeclaring interface methods #6266

Closed
@niagr

Description

@niagr
interface IFoo {
    func (str: string): number;
}

declare class CFoo implements IFoo {
    func2 (): void;
}

error TS2420: Class 'CFoo' incorrectly implements interface 'IFoo'.
Property 'func' is missing in type 'CFoo'.

Since this is just a declaration, we shouldn't have to manually redeclare all implemented methods, this should be implied by declaring that the class implements the interface. We are simply declaring that this class exists and it implements said interface and additionally defines these methods. The requirement for the class to implement those methods should only apply to the actual class definition.

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