refactor(zone.js): move Error type into declare global block in zone.ts (#53443)

This helps consolidate globals into a single declaration in a single file.

PR Close #53443
This commit is contained in:
Doug Parker 2023-12-07 18:38:47 -08:00 committed by Alex Rickabaugh
parent d8db402833
commit 52d672dd13
2 changed files with 15 additions and 17 deletions

View file

@ -10,23 +10,6 @@
* @suppress {globalThis,undefinedVars}
*/
declare global {
/**
* Extend the Error with additional fields for rewritten stack frames
*/
interface Error {
/**
* Stack trace where extra frames have been removed and zone names added.
*/
zoneAwareStack?: string;
/**
* Original stack trace with no modifications
*/
originalStack?: string;
}
}
Zone.__load_patch('Error', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
/*
* This code patches Error so that:

View file

@ -26,6 +26,21 @@ declare global {
type MicroTask = _MicroTask;
type MacroTask = _MacroTask;
type EventTask = _EventTask;
/**
* Extend the Error with additional fields for rewritten stack frames
*/
interface Error {
/**
* Stack trace where extra frames have been removed and zone names added.
*/
zoneAwareStack?: string;
/**
* Original stack trace with no modifications
*/
originalStack?: string;
}
}
// if global['Zone'] already exists (maybe zone.js was already loaded or