Skip to content

Added parameterless constructors in android typings - #6044

Merged
vtrifonov merged 2 commits into
masterfrom
trifonov/typings-empty-constructor
Jul 13, 2018
Merged

vtrifonov merged 2 commits into
masterfrom
trifonov/typings-empty-constructor

Conversation

@vtrifonov

Copy link
Copy Markdown
Contributor

Related to: #6031

Currently in android typings we are generating classes accepting an implementation object for android interfaces. However if you want to create a class that implements an android interface you cannot just extend the generated android class as you'll need to supply the implementation in the super call. Here's an example:

class RunnableImpl extends java.lang.Runnable {
    constructor(private message: string) {
        super();
    }

    run() {
        console.log(this.message);
    }
}

var myRunable = new RunnableImpl("testing");

var handler = new android.os.Handler();
handler.postDelayed(myRunable, 5000);

In order this to be a valid typescript using the android typings we need to have a parameterless constructor in the java.lang.Runnable class.
So this PR adds such an empty constructor to each class generated from android interface.

@ghost ghost assigned vtrifonov Jul 9, 2018
@ghost ghost added the in progress label Jul 9, 2018
@ns-bot ns-bot added the cla: yes label Jul 9, 2018
@vtrifonov
vtrifonov requested a review from vakrilov July 13, 2018 08:25
@vtrifonov
vtrifonov merged commit 8b22585 into master Jul 13, 2018
@ghost ghost removed the in progress label Jul 13, 2018
@vtrifonov
vtrifonov deleted the trifonov/typings-empty-constructor branch July 13, 2018 14:29
@lock

lock Bot commented Aug 26, 2019

Copy link
Copy Markdown

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock Bot locked and limited conversation to collaborators Aug 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants