Skip to content

Commit 90c0772

Browse files
JiaLiPassionalxhub
authored andcommitted
fix(zone.js): remove global declaration (#37861)
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
1 parent 67069ce commit 90c0772

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
// CommonJS / Node have global context exposed as "global" variable.
10+
// This code should run in a Browser, so we don't want to include the whole node.d.ts
11+
// typings for this compilation unit.
12+
// We'll just fake the global "global" var for now.
13+
declare var global: NodeJS.Global;

packages/zone.js/lib/zone.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -675,12 +675,6 @@ type AmbientZone = Zone;
675675
/** @internal */
676676
type AmbientZoneDelegate = ZoneDelegate;
677677

678-
// CommonJS / Node have global context exposed as "global" variable.
679-
// This code should run in a Browser, so we don't want to include the whole node.d.ts
680-
// typings for this compilation unit.
681-
// We'll just fake the global "global" var for now.
682-
declare var global: NodeJS.Global;
683-
684678
const Zone: ZoneType = (function(global: any) {
685679
const performance: {mark(name: string): void; measure(name: string, label: string): void;} =
686680
global['performance'];

0 commit comments

Comments
 (0)