mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 05:50:11 +01:00
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
This commit is contained in:
parent
a5298e13bb
commit
d1b144b37b
1 changed files with 10 additions and 1 deletions
|
|
@ -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;`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue