fix(compiler): correctly type event handler proxy functions

This commit is contained in:
Tobias Bosch
2016-09-06 07:49:38 -07:00
committed by Martin Probst
parent 7192fec841
commit aa9b617c9d
3 changed files with 48 additions and 10 deletions

View File

@ -351,7 +351,7 @@ export abstract class AppView<T> {
}
}
eventHandler(cb: Function): Function { return cb; }
eventHandler<E, R>(cb: (event?: E) => R): (event?: E) => R { return cb; }
throwDestroyedError(details: string): void { throw new ViewDestroyedError(details); }
}
@ -434,9 +434,9 @@ export class DebugAppView<T> extends AppView<T> {
}
}
eventHandler(cb: Function): Function {
eventHandler<E, R>(cb: (event?: E) => R): (event?: E) => R {
var superHandler = super.eventHandler(cb);
return (event: any) => {
return (event?: any) => {
this._resetDebug();
try {
return superHandler(event);