Skip to content

Constant overload doesn't complain about incorrect call #2021

Closed
@dbaeumer

Description

@dbaeumer

Test Case:

interface Overload {

foo(id:"special", value:number):void;
foo(id:string, value:any):void;

}

class Bug {

private overload:Overload;

public call():void {
    this.overload.foo("special", "");
}

}

Compile with tsc. Observe that there is no error message. Shouldn't the compiler complain about the fact that this.overload.foo("special", "") is an incompatible call. E.g. "" is not assignment compatible to number.

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