我正在尝试覆盖超类的方法并使用 Google Closure Compiler 编译代码,但我收到有关错误类型的警告。
/Users/Jan/dev/cro/public/app/js/LibraryController.js:55: WARNING -
mismatch of the setState property type and the type of the property it overrides
from superclass app.Controller
original: function (this:app.Controller, Object): undefined
override: function (this:app.LibraryController, Object, string, string): undefined
app.LibraryController.prototype.setState = function (state, section, article) {
如您所见,我没有更改 super 方法接受的参数类型,也没有更改返回的类型。
有谁知道如何解决这个问题?谢谢。
为了澄清,这里是各个方法的定义。
/**
* @param {!Object} state The new state.
*/
app.Controller.prototype.setState = function (state) { ... };
/**
* @param {!Object} state The new state.
* @param {string} section A section ID.
* @param {string} article An article ID.
* @override
*/
app.LibraryController.prototype.setState = function (state, section, article) { ... }