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 {
}

View File

@ -15,18 +15,33 @@ import {MultipleComponentsMyComp, NextComp} from './a/multiple_components';
import {AnimateCmp} from './animate';
import {BasicComp} from './basic';
import {CompWithAnalyzeEntryComponentsProvider, CompWithEntryComponents} from './entry_components';
import {CompUsingPipes, CompWithProviders, CompWithReferences, ModuleUsingCustomElements} from './features';
import {CompConsumingEvents, CompUsingPipes, CompWithProviders, CompWithReferences, DirPublishingEvents, ModuleUsingCustomElements} from './features';
import {CompUsingRootModuleDirectiveAndPipe, SomeDirectiveInRootModule, SomePipeInRootModule, SomeService, someLibModuleWithProviders} from './module_fixtures';
import {CompWithNgContent, ProjectingComp} from './projection';
import {CompForChildQuery, CompWithChildQuery, CompWithDirectiveChild, DirectiveForQuery} from './queries';
@NgModule({
declarations: [
SomeDirectiveInRootModule, SomePipeInRootModule, AnimateCmp, BasicComp, CompForChildQuery,
CompWithEntryComponents, CompWithAnalyzeEntryComponentsProvider, ProjectingComp,
CompWithChildQuery, CompWithDirectiveChild, CompWithNgContent,
CompUsingRootModuleDirectiveAndPipe, CompWithProviders, CompWithReferences, CompUsingPipes,
MultipleComponentsMyComp, DirectiveForQuery, NextComp
SomeDirectiveInRootModule,
SomePipeInRootModule,
AnimateCmp,
BasicComp,
CompForChildQuery,
CompWithEntryComponents,
CompWithAnalyzeEntryComponentsProvider,
ProjectingComp,
CompWithChildQuery,
CompWithDirectiveChild,
CompWithNgContent,
CompUsingRootModuleDirectiveAndPipe,
CompWithProviders,
CompWithReferences,
CompUsingPipes,
CompConsumingEvents,
DirPublishingEvents,
MultipleComponentsMyComp,
DirectiveForQuery,
NextComp,
],
imports: [
BrowserModule, FormsModule, someLibModuleWithProviders(), ModuleUsingCustomElements,