fix(core): don't include a local `EventListener` in typings (#29809)
With dts bundles, `core.d.ts` will include an `EventListener` class as it's used in 303eae918d/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
PR Close #29809
This commit is contained in:
parent
4271d35dc4
commit
4bde40f7c2
|
@ -22,7 +22,7 @@ export {APP_INITIALIZER, ApplicationInitStatus} from './application_init';
|
|||
export * from './zone';
|
||||
export * from './render';
|
||||
export * from './linker';
|
||||
export {DebugElement, DebugNode, asNativeElements, getDebugNode, Predicate} from './debug/debug_node';
|
||||
export {DebugElement, DebugEventListener, DebugNode, asNativeElements, getDebugNode, Predicate} from './debug/debug_node';
|
||||
export {GetTestability, Testability, TestabilityRegistry, setTestabilityGetter} from './testability/testability';
|
||||
export * from './change_detection';
|
||||
export * from './platform_core_providers';
|
||||
|
|
|
@ -21,7 +21,10 @@ import {getComponentViewByIndex, getNativeByTNode, isComponent, isLContainer} fr
|
|||
import {assertDomNode} from '../util/assert';
|
||||
import {DebugContext} from '../view/index';
|
||||
|
||||
export class EventListener {
|
||||
/**
|
||||
* @publicApi
|
||||
*/
|
||||
export class DebugEventListener {
|
||||
constructor(public name: string, public callback: Function) {}
|
||||
}
|
||||
|
||||
|
@ -29,7 +32,7 @@ export class EventListener {
|
|||
* @publicApi
|
||||
*/
|
||||
export interface DebugNode {
|
||||
readonly listeners: EventListener[];
|
||||
readonly listeners: DebugEventListener[];
|
||||
readonly parent: DebugElement|null;
|
||||
readonly nativeNode: any;
|
||||
readonly injector: Injector;
|
||||
|
@ -39,7 +42,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;
|
||||
|
@ -219,7 +222,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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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__, DebugEventListener, DebugNode__PRE_R3__, getDebugNode, indexDebugNode, removeDebugNodeFromIndex} from '../debug/debug_node';
|
||||
import {Injector} from '../di';
|
||||
import {InjectableType} from '../di/injectable';
|
||||
import {getInjectableDef, ɵɵInjectableDef} from '../di/interface/defs';
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,11 +224,17 @@ export declare const DebugElement: {
|
|||
new (...args: any[]): DebugElement;
|
||||
};
|
||||
|
||||
export declare class DebugEventListener {
|
||||
callback: Function;
|
||||
name: string;
|
||||
constructor(name: string, callback: Function);
|
||||
}
|
||||
|
||||
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[];
|
||||
|
|
Loading…
Reference in New Issue