Skip to content

Commit

Permalink
fix(core): remove EventListener from it's exports
Browse files Browse the repository at this point in the history
With dts bundles, `core.d.ts` will include an `EventListener` class as it's used in https://github.com/angular/angular/blob/303eae918d997070a36b523ddc97e018f622c258/packages/core/src/debug/debug_node.ts#L32

This will conflict with the DOM EventListener, as anything in `core.d.ts` which is using the DOM EventListener will fallback in using the one defined in the same module and hence build will fail because their implementation is different.

With this change, we rename the local `EventListener` to `DebugEventListener`, the later one is non exported.

Fixes #29806
  • Loading branch information
alan-agius4 committed Apr 10, 2019
1 parent db62ccf commit 7557656
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/debug/debug_node.ts
Expand Up @@ -21,15 +21,15 @@ import {getComponentViewByIndex, getNativeByTNode, isComponent, isLContainer} fr
import {assertDomNode} from '../util/assert';
import {DebugContext} from '../view/index';

export class EventListener {
export class DebugEventListener {
constructor(public name: string, public callback: Function) {}
}

/**
* @publicApi
*/
export interface DebugNode {
readonly listeners: EventListener[];
readonly listeners: DebugEventListener[];
readonly parent: DebugElement|null;
readonly nativeNode: any;
readonly injector: Injector;
Expand All @@ -39,7 +39,7 @@ export interface DebugNode {
readonly providerTokens: any[];
}
export class DebugNode__PRE_R3__ {
readonly listeners: EventListener[] = [];
readonly listeners: DebugEventListener[] = [];
readonly parent: DebugElement|null = null;
readonly nativeNode: any;
private readonly _debugContext: DebugContext;
Expand Down Expand Up @@ -219,7 +219,7 @@ class DebugNode__POST_R3__ implements DebugNode {
}
get context(): any { return getContext(this.nativeNode as Element); }

get listeners(): EventListener[] {
get listeners(): DebugEventListener[] {
return getListeners(this.nativeNode as Element).filter(isBrowserEvents);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/view/services.ts
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {DebugElement__PRE_R3__, DebugNode__PRE_R3__, EventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
import {DebugElement__PRE_R3__, DebugNode__PRE_R3__, DebugEventListener, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
import {Injector} from '../di';
import {InjectableType} from '../di/injectable';
import {InjectableDef, getInjectableDef} from '../di/interface/defs';
Expand Down Expand Up @@ -827,7 +827,7 @@ export class DebugRenderer2 implements Renderer2 {
if (typeof target !== 'string') {
const debugEl = getDebugNode(target);
if (debugEl) {
debugEl.listeners.push(new EventListener(eventName, callback));
debugEl.listeners.push(new DebugEventListener(eventName, callback));
}
}

Expand Down
2 changes: 1 addition & 1 deletion tools/public_api_guard/core/core.d.ts
Expand Up @@ -228,7 +228,7 @@ export interface DebugNode {
readonly componentInstance: any;
readonly context: any;
readonly injector: Injector;
readonly listeners: EventListener[];
readonly listeners: DebugEventListener[];
readonly nativeNode: any;
readonly parent: DebugElement | null;
readonly providerTokens: any[];
Expand Down

0 comments on commit 7557656

Please sign in to comment.