From 4feec728c0fa307bbf670a5fa3aa0c3a73b8a210 Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Fri, 12 Jan 2024 11:43:54 -0800 Subject: [PATCH] refactor(zone.js): export previously global types from `zone-impl.ts`. (#53443) This allows the types to be directly imported when used. PR Close #53443 --- packages/zone.js/lib/zone-impl.ts | 34 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/zone.js/lib/zone-impl.ts b/packages/zone.js/lib/zone-impl.ts index ce86101b1f1..890a92e10cc 100644 --- a/packages/zone.js/lib/zone-impl.ts +++ b/packages/zone.js/lib/zone-impl.ts @@ -133,7 +133,7 @@ * zones are children of the root zone. * */ -interface Zone { +export interface Zone { /** * * @returns {Zone} The parent Zone. @@ -287,7 +287,7 @@ interface Zone { cancelTask(task: Task): any; } -interface ZoneType { +export interface ZoneType { /** * @returns {Zone} Returns the current [Zone]. The only way to change * the current zone is by invoking a run() method, which will update the current zone for the @@ -325,13 +325,13 @@ interface ZoneType { /** * Patch Function to allow user define their own monkey patch module. */ -type _PatchFn = (global: Window, Zone: ZoneType, api: _ZonePrivate) => void; +export type _PatchFn = (global: Window, Zone: ZoneType, api: _ZonePrivate) => void; /** * _ZonePrivate interface to provide helper method to help user implement * their own monkey patch module. */ -interface _ZonePrivate { +export interface _ZonePrivate { currentZoneFrame: () => _ZoneFrame; symbol: (name: string) => string; scheduleMicroTask: (task?: MicroTask) => void; @@ -375,12 +375,12 @@ interface _ZonePrivate { /** * _ZoneFrame represents zone stack frame information */ -interface _ZoneFrame { +export interface _ZoneFrame { parent: _ZoneFrame|null; zone: Zone; } -interface UncaughtPromiseError extends Error { +export interface UncaughtPromiseError extends Error { zone: Zone; task: Task; promise: Promise; @@ -393,7 +393,7 @@ interface UncaughtPromiseError extends Error { * * Only the `name` property is required (all other are optional). */ -interface ZoneSpec { +export interface ZoneSpec { /** * The name of the zone. Useful when debugging Zones. */ @@ -529,7 +529,7 @@ interface ZoneSpec { * Note: The ZoneDelegate treats ZoneSpec as class. This allows the ZoneSpec to use its `this` to * store internal state. */ -interface ZoneDelegate { +export interface ZoneDelegate { zone: Zone; fork(targetZone: Zone, zoneSpec: ZoneSpec): Zone; intercept(targetZone: Zone, callback: Function, source: string): Function; @@ -542,24 +542,24 @@ interface ZoneDelegate { hasTask(targetZone: Zone, isEmpty: HasTaskState): void; } -type HasTaskState = { +export type HasTaskState = { microTask: boolean; macroTask: boolean; eventTask: boolean; change: TaskType; }; /** * Task type: `microTask`, `macroTask`, `eventTask`. */ -type TaskType = 'microTask'|'macroTask'|'eventTask'; +export type TaskType = 'microTask'|'macroTask'|'eventTask'; /** * Task type: `notScheduled`, `scheduling`, `scheduled`, `running`, `canceling`, 'unknown'. */ -type TaskState = 'notScheduled'|'scheduling'|'scheduled'|'running'|'canceling'|'unknown'; +export type TaskState = 'notScheduled'|'scheduling'|'scheduled'|'running'|'canceling'|'unknown'; /** */ -interface TaskData { +export interface TaskData { /** * A periodic [MacroTask] is such which get automatically rescheduled after it is executed. */ @@ -593,7 +593,7 @@ interface TaskData { * queue. This happens when the event fires. * */ -interface Task { +export interface Task { /** * Task type: `microTask`, `macroTask`, `eventTask`. */ @@ -660,19 +660,19 @@ interface Task { cancelScheduleRequest(): void; } -interface MicroTask extends Task { +export interface MicroTask extends Task { type: 'microTask'; } -interface MacroTask extends Task { +export interface MacroTask extends Task { type: 'macroTask'; } -interface EventTask extends Task { +export interface EventTask extends Task { type: 'eventTask'; } -type AmbientZone = Zone; +export type AmbientZone = Zone; // Initialize global `Zone` constant. (function(global: any) {