瀏覽代碼

Merge pull request #3137 from remcohaszing/fix-monaco-environment-types

Fix MonacoEnvironment types
Henning Dieterichs 3 年之前
父節點
當前提交
58100e52b8
共有 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;`;