Skip to content

Commit

Permalink
fix(zone.js): remove global declaration (#37861)
Browse files Browse the repository at this point in the history
Close #37531

Remove `global` declaration in `zone.ts` to avoid compile error when
upgrade to `@types/node` v12.12.68. Since the new type of global become
`NodeJS.global & typeof globalThis` and not compatible with `zone.ts` declaration.

PR Close #37861
  • Loading branch information
JiaLiPassion authored and alxhub committed Oct 23, 2020
1 parent 67069ce commit 90c0772
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 13 additions & 0 deletions packages/zone.js/lib/zone-global.d.ts
@@ -0,0 +1,13 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

// CommonJS / Node have global context exposed as "global" variable.
// This code should run in a Browser, so we don't want to include the whole node.d.ts
// typings for this compilation unit.
// We'll just fake the global "global" var for now.
declare var global: NodeJS.Global;
6 changes: 0 additions & 6 deletions packages/zone.js/lib/zone.ts
Expand Up @@ -675,12 +675,6 @@ type AmbientZone = Zone;
/** @internal */
type AmbientZoneDelegate = ZoneDelegate;

// CommonJS / Node have global context exposed as "global" variable.
// This code should run in a Browser, so we don't want to include the whole node.d.ts
// typings for this compilation unit.
// We'll just fake the global "global" var for now.
declare var global: NodeJS.Global;

const Zone: ZoneType = (function(global: any) {
const performance: {mark(name: string): void; measure(name: string, label: string): void;} =
global['performance'];
Expand Down

0 comments on commit 90c0772

Please sign in to comment.