Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

Add types for TypeScriptWorker and missing LanguageServiceDefaults methods #54

Merged
merged 6 commits into from
Jan 23, 2020

Conversation

ecraig12345
Copy link
Member

@ecraig12345 ecraig12345 commented Jan 22, 2020

Update monaco.d.ts with a definition for TypeScriptWorker and a few of the types from typescript that it depends on, and use the proper return type for getTypeScriptWorker/getJavaScriptWorker.

To avoid polluting the monaco.languages.typescript module and its docs, I only copied in a few of the typescript types (lacking a better heuristic, the ones I need to use) and used any for the rest, with comments about the actual types. You can see what it would look like with all the types in this commit (note I had them in a separate monaco.languages.typescript.ts namespace at the time), and I could add them back if preferable.

Also update LanguageServiceDefaults types to add some methods that were missing, and update CompilerOptions to add newer compiler options.

Remove the declaration: true setting from tsconfig since the unqualified references to monaco in the generated files can cause problems in other projects (and since those generated files don't impact the final editor.api.d.ts).

@alexdima
Copy link
Member

@ecraig12345 Do you then still need #50 ?

@ecraig12345
Copy link
Member Author

@alexdima Probably not, and from some issues I saw I'm wondering if it actually created some problems since the declaration files contain references to monaco without any imports. (That works in the context of this project with how its tsconfig is set up, but isn't likely to work elsewhere.) So I just pushed a commit removing declaration: true.

@ecraig12345
Copy link
Member Author

It would be nice if there was a way to directly generate the monaco.d.ts files from the source, so they don't get out of sync, but I'm guessing that would be a lot more complicated.

@alexdima
Copy link
Member

👍 Thank you!

@alexdima alexdima merged commit e623bb9 into microsoft:master Jan 23, 2020
@alexdima alexdima added this to the January 2020 milestone Jan 23, 2020
@ecraig12345 ecraig12345 deleted the add-typescript-types branch January 23, 2020 18:21
@orta
Copy link
Contributor

orta commented Jan 23, 2020

<3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants