From 00b655add1c83a3924f1e86b51689aa1ed8e5d05 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Thu, 17 Jan 2019 09:57:15 +1100 Subject: Add globalThis definition to runtime (#1534) --- tools/ts_library_builder/build_library.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools/ts_library_builder/build_library.ts') diff --git a/tools/ts_library_builder/build_library.ts b/tools/ts_library_builder/build_library.ts index 00e942540..0717de987 100644 --- a/tools/ts_library_builder/build_library.ts +++ b/tools/ts_library_builder/build_library.ts @@ -156,6 +156,10 @@ export function mergeGlobal({ // Declare the global variable addVariableDeclaration(targetSourceFile, globalVarName, interfaceName, true); + // `globalThis` accesses the global scope and is defined here: + // https://github.com/tc39/proposal-global + addVariableDeclaration(targetSourceFile, "globalThis", interfaceName, true); + // Add self reference to the global variable addInterfaceProperty(interfaceDeclaration, globalVarName, interfaceName); -- cgit v1.2.3