fix(zone.js): don't rely on global node typings outside of node/ directory (#31783)

PR Close #31783
This commit is contained in:
Alex Eagle
2019-07-22 10:59:42 -07:00
committed by Andrew Kushnir
parent 3479fddf68
commit 5c9a8961da
3 changed files with 23 additions and 14 deletions

View File

@ -675,6 +675,12 @@ 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'];