Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

strict mode error when implementing interface method overloads #421

Open
nippur72 opened this issue May 29, 2015 · 3 comments
Open

strict mode error when implementing interface method overloads #421

nippur72 opened this issue May 29, 2015 · 3 comments

Comments

@nippur72
Copy link
Contributor

I'm trying to implement IPromise:

public class FakePromise : IPromise
{
    public void Then(Delegate fulfilledHandler)
    {
    }

    public void Then(Delegate fulfilledHandler, Delegate errorHandler)
    {
    }

    public void Then(Delegate fulfilledHandler, Delegate errorHandler, Delegate progressHandler)
    {
    }
}

but I get a browser error: unallowed multiple properties definition in strict mode

I think it's because it gets transpiled to:

ss.initClass($FakePromise, $asm, {
        then: function(fulfilledHandler) {
        },
        then: function(fulfilledHandler, errorHandler) {
        },
        then: function(fulfilledHandler, errorHandler, progressHandler) {
        }
    });
@erik-kallen
Copy link
Contributor

That's an unintended consequence.

I think that if you use the roslyn branch, things will work better in this case (because there is only one Then method, which is possible due to improved optional arguments support)

@erik-kallen
Copy link
Contributor

You might get away with specifying [NonScriptable] on some of the methods in your implementing class.

@nippur72
Copy link
Contributor Author

yes, that fixes it.

@erik-kallen erik-kallen added this to the 3.0 milestone Jul 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants