Skip to content

Commit b3d045b

Browse files
committed
fix(zone.js): Add 'declare' to each interface to prevent renaming (#54966)
This commit adds `declare` to each interface in the `zone-impl` to prevent renaming of any interface properties by compiler optimizations. This would otherwise cause issues if multiple applications depend on ZoneJS and compile the interface properties to different names. PR Close #54966
1 parent 2dced3a commit b3d045b

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

packages/zone.js/lib/zone-impl.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
* zones are children of the root zone.
134134
*
135135
*/
136-
export interface Zone {
136+
export declare interface Zone {
137137
/**
138138
*
139139
* @returns {Zone} The parent Zone.
@@ -287,7 +287,7 @@ export interface Zone {
287287
cancelTask(task: Task): any;
288288
}
289289

290-
export interface ZoneType {
290+
export declare interface ZoneType {
291291
/**
292292
* @returns {Zone} Returns the current [Zone]. The only way to change
293293
* the current zone is by invoking a run() method, which will update the current zone for the
@@ -331,7 +331,7 @@ export type PatchFn = (global: Window, Zone: ZoneType, api: ZonePrivate) => void
331331
* ZonePrivate interface to provide helper method to help user implement
332332
* their own monkey patch module.
333333
*/
334-
export interface ZonePrivate {
334+
export declare interface ZonePrivate {
335335
currentZoneFrame: () => ZoneFrame;
336336
symbol: (name: string) => string;
337337
scheduleMicroTask: (task?: MicroTask) => void;
@@ -375,12 +375,12 @@ export interface ZonePrivate {
375375
/**
376376
* ZoneFrame represents zone stack frame information
377377
*/
378-
export interface ZoneFrame {
378+
export declare interface ZoneFrame {
379379
parent: ZoneFrame|null;
380380
zone: Zone;
381381
}
382382

383-
export interface UncaughtPromiseError extends Error {
383+
export declare interface UncaughtPromiseError extends Error {
384384
zone: Zone;
385385
task: Task;
386386
promise: Promise<any>;
@@ -393,7 +393,7 @@ export interface UncaughtPromiseError extends Error {
393393
*
394394
* Only the `name` property is required (all other are optional).
395395
*/
396-
export interface ZoneSpec {
396+
export declare interface ZoneSpec {
397397
/**
398398
* The name of the zone. Useful when debugging Zones.
399399
*/
@@ -529,7 +529,7 @@ export interface ZoneSpec {
529529
* Note: The ZoneDelegate treats ZoneSpec as class. This allows the ZoneSpec to use its `this` to
530530
* store internal state.
531531
*/
532-
export interface ZoneDelegate {
532+
export declare interface ZoneDelegate {
533533
zone: Zone;
534534
fork(targetZone: Zone, zoneSpec: ZoneSpec): Zone;
535535
intercept(targetZone: Zone, callback: Function, source: string): Function;
@@ -559,7 +559,7 @@ export type TaskState = 'notScheduled'|'scheduling'|'scheduled'|'running'|'cance
559559

560560
/**
561561
*/
562-
export interface TaskData {
562+
export declare interface TaskData {
563563
/**
564564
* A periodic [MacroTask] is such which get automatically rescheduled after it is executed.
565565
*/
@@ -593,7 +593,7 @@ export interface TaskData {
593593
* queue. This happens when the event fires.
594594
*
595595
*/
596-
export interface Task {
596+
export declare interface Task {
597597
/**
598598
* Task type: `microTask`, `macroTask`, `eventTask`.
599599
*/
@@ -660,15 +660,15 @@ export interface Task {
660660
cancelScheduleRequest(): void;
661661
}
662662

663-
export interface MicroTask extends Task {
663+
export declare interface MicroTask extends Task {
664664
type: 'microTask';
665665
}
666666

667-
export interface MacroTask extends Task {
667+
export declare interface MacroTask extends Task {
668668
type: 'macroTask';
669669
}
670670

671-
export interface EventTask extends Task {
671+
export declare interface EventTask extends Task {
672672
type: 'eventTask';
673673
}
674674

0 commit comments

Comments
 (0)