Skip to content
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

TypeScript should be able to support method overloading #11702

Closed
MrMatthewLayton opened this issue Oct 18, 2016 · 2 comments
Closed

TypeScript should be able to support method overloading #11702

MrMatthewLayton opened this issue Oct 18, 2016 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@MrMatthewLayton
Copy link

Since TypeScript is statically typed, it should be able to infer method usage based on supplied parameters, however I can already see a potential limitation in the emitted code - as long as JS is considered "read-only" this probably wont matter (much)

Example

class Test {
    public getResult(value: string): boolean {
        ...
    }

    public getResult(x: number, y: number, z: number): string {
        ...
    }
}

Compiled

var Test = (function () {
    function Test() {
    }

    Test.prototype.getResult$s0 = function(value) {
        ...
    }

    Test.prototype.getResult$n0$n1$n2 = function(x, y, z) {
        ...
    }

    return Test;
})();
@kitsonk
Copy link
Contributor

kitsonk commented Oct 18, 2016

Dupe of #3442

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Oct 18, 2016
@RyanCavanaugh
Copy link
Member

Please search for existing issues before logging new ones.

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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