Add types for MonacoEnvironment (microsoft/monaco-editor#1795)

This commit is contained in:
Alex Dima 2020-02-03 23:14:21 +01:00
parent 2ce45bf734
commit 65fee79198
No known key found for this signature in database
GPG key ID: 6E58D7B045760DA0
3 changed files with 22 additions and 5 deletions

View file

@ -227,8 +227,13 @@ function toExternalDTS(contents) {
if (line.indexOf('declare namespace monaco.') === 0) {
lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
}
if (line.indexOf('declare let MonacoEnvironment') === 0) {
lines[i] = `declare global {\n let MonacoEnvironment: Environment | undefined;\n}`;
// lines[i] = line.replace('declare namespace monaco.', 'export namespace ');
}
}
return lines.join('\n');
return lines.join('\n').replace(/\n\n\n+/g, '\n\n');
}
function filterStream(testFunc) {

View file

@ -3,12 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare let MonacoEnvironment: monaco.Environment | undefined;
declare namespace monaco {
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export type Thenable<T> = PromiseLike<T>;
export interface Environment {
baseUrl?: string;
getWorker?(workerId: string, label: string): Worker;
getWorkerUrl?(workerId: string, label: string): string;
}
export interface IDisposable {
dispose(): void;
}

10
src/vs/monaco.d.ts vendored
View file

@ -3,12 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare let MonacoEnvironment: monaco.Environment | undefined;
declare namespace monaco {
// THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.
export type Thenable<T> = PromiseLike<T>;
export interface Environment {
baseUrl?: string;
getWorker?(workerId: string, label: string): Worker;
getWorkerUrl?(workerId: string, label: string): string;
}
export interface IDisposable {
dispose(): void;
}