mihaip / react-closure-compiler

Tooling to teach Closure Compiler about React
Apache License 2.0
100 stars 14 forks source link

Make sure we include parameters in mixin interface methods #46

Closed arv closed 5 years ago

arv commented 5 years ago

For a mixin we generate an interface. We were not setting the parameters in the methods. Like this

class Mixin extends React.Component {
    /** @param {number} x */
    method(x) {}
}
ReactSupport.declareMixin(Mixin);

generated:

/** @interface */
function MixinInterface() {}
/** @param {number} x */
MixinInterface.prototype.method = function() {}

The last line above needs to be:

MixinInterface.prototype.method = function(x) {}

or x gets marked as optional which leads to issues when overriding.