Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish typings for monaco-typescript TypeScriptWorker #1491

Closed
ecraig12345 opened this issue Jun 21, 2019 · 0 comments · Fixed by microsoft/monaco-typescript#50
Closed

Publish typings for monaco-typescript TypeScriptWorker #1491

ecraig12345 opened this issue Jun 21, 2019 · 0 comments · Fixed by microsoft/monaco-typescript#50
Labels
feature-request Request for new features or functionality typescript
Milestone

Comments

@ecraig12345
Copy link
Member

monaco-editor version: 0.17.0
Browser: n/a
OS: n/a

Steps or JS usage snippet reproducing the issue:

I'm working on a browser-based live code editor where we'd like to use various APIs from the TypeScriptWorker, for example getEmitOutput to compile our code--similar to #289.

However, in the typings the API to get the worker returns any, and there's no declaration file generated/published for the TypeScriptWorker file. This makes the worker much less convenient/safe to use.

import * as monaco from 'monaco-editor';

const editor = monaco.editor.create(/*args*/);
const uri = editor.getModel().uri;
// This should have type TypeScriptWorker but actually has type any
const worker = await monaco.languages.typescript.getTypeScriptWorker();
// Now this code isn't type-safe and the API methods aren't discoverable
const workerInstance = await worker(uri);
const result = await workerInstance.getEmitOutput(uri.toString());

We worked around the issue locally by cloning monaco-typescript, building it with declaration: true set in the tsconfig, and copying the declaration files into our project--but it would be much better if the complete typings were included in the published package.

cc: @nishikaza @sopranopillow @kenotron

@alexdima alexdima added typescript feature-request Request for new features or functionality labels Nov 20, 2019
@alexdima alexdima added this to the Backlog Candidates milestone Dec 10, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants