Skip to content

Constant overload doesn't complain about incorrect call #2021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dbaeumer opened this issue Feb 12, 2015 · 1 comment
Closed

Constant overload doesn't complain about incorrect call #2021

dbaeumer opened this issue Feb 12, 2015 · 1 comment
Labels
Duplicate An existing issue was already created

Comments

@dbaeumer
Copy link
Member

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.

@NoelAbrahams
Copy link

Possible duplicate of #191. It'll be nice to have an error here, but there are complications.

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Feb 12, 2015
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants