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

@ -7,7 +7,8 @@
*/
import * as common from '@angular/common';
import {CUSTOM_ELEMENTS_SCHEMA, Component, Inject, NgModule, OpaqueToken} from '@angular/core';
import {CUSTOM_ELEMENTS_SCHEMA, Component, Directive, EventEmitter, Inject, NgModule, OpaqueToken, Output} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {wrapInArray} from './funcs';
@ -51,6 +52,28 @@ export class CompUsingPipes {
export class CompUsingCustomElements {
}
@Component({
selector: 'cmp-event',
template: `
<div (click)="handleDomEventVoid($event)"></div>
<div (click)="handleDomEventPreventDefault($event)"></div>
<div (dirEvent)="handleDirEvent($event)"></div>
`,
})
export class CompConsumingEvents {
handleDomEventVoid(e: any): void {}
handleDomEventPreventDefault(e: any): boolean { return false; }
handleDirEvent(e: any): void {}
}
@Directive({
selector: '[dirEvent]',
})
export class DirPublishingEvents {
@Output('dirEvent')
dirEvent: Observable<string> = new EventEmitter();
}
@NgModule({schemas: [CUSTOM_ELEMENTS_SCHEMA], declarations: wrapInArray(CompUsingCustomElements)})
export class ModuleUsingCustomElements {
}