From d1b144b37b22e334f4743b22c3fae10f32c358bd Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Thu, 9 Jun 2022 14:08:39 +0200 Subject: [PATCH] Fix MonacoEnvironment types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some attempts were made in the past to fix it, but they don’t actually work, as they don’t override the global Window interface. Fixes #2958 --- build/release.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build/release.ts b/build/release.ts index f9c09624..38eef1b6 100644 --- a/build/release.ts +++ b/build/release.ts @@ -364,7 +364,16 @@ function toExternalDTS(contents: string): string { } if (line.indexOf('declare let MonacoEnvironment') === 0) { - lines[i] = `declare global {\n let MonacoEnvironment: Environment | undefined;\n}`; + lines[i] = [ + 'declare global {', + ' let MonacoEnvironment: Environment | undefined;', + '', + ' interface Window {', + ' MonacoEnvironment?: Environment | undefined;', + ' }', + '}', + '' + ].join('\n'); } if (line.indexOf(' MonacoEnvironment?') === 0) { lines[i] = ` MonacoEnvironment?: Environment | undefined;`;