Преглед на файлове

Fix MonacoEnvironment types

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
Remco Haszing преди 3 години
родител
ревизия
d1b144b37b
променени са 1 файла, в които са добавени 10 реда и са изтрити 1 реда
  1. 10 1
      build/release.ts

+ 10 - 1
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;`;