pull/2748/head
Orta 5 years ago
parent 3e1a236812
commit c402ee962f

@ -247,12 +247,12 @@ export function create(ctx: IWorkerContext, createData: ICreateData): TypeScript
// @ts-ignore - This is available in a webworker // @ts-ignore - This is available in a webworker
if (typeof importScripts === "undefined") { if (typeof importScripts === "undefined") {
console.warn("Monaco is not using webworker workers, and that is needed to support the customWorkerPath flag") console.warn("Monaco is not using webworkers for background tasks, and that is needed to support the customWorkerPath flag")
} else { } else {
// @ts-ignore - This is available in a webworker // @ts-ignore - This is available in a webworker
importScripts(createData.customWorkerPath) importScripts(createData.customWorkerPath)
// @ts-ignore - This should come from // @ts-ignore - This should come from the above eval
if(!self.extendTSWorkerFactory) { if (!self.extendTSWorkerFactory) {
throw new Error(`The script at ${createData.customWorkerPath} does not add extendTSWorkerFactory to self`) throw new Error(`The script at ${createData.customWorkerPath} does not add extendTSWorkerFactory to self`)
} }
// @ts-ignore - The throw validates this // @ts-ignore - The throw validates this

@ -203,7 +203,6 @@
document.getElementById('logDTS').onclick = async () => { document.getElementById('logDTS').onclick = async () => {
const model = editor.getModel() const model = editor.getModel()
const worker = await monaco.languages.typescript.getTypeScriptWorker() const worker = await monaco.languages.typescript.getTypeScriptWorker()
const thisWorker = await worker(model.uri) const thisWorker = await worker(model.uri)
const dts = await thisWorker.getDTSEmitForFile(model.uri.toString()) const dts = await thisWorker.getDTSEmitForFile(model.uri.toString())

@ -1,5 +1,3 @@
/// <reference lib="webworker">
self.extendTSWorkerFactory = (TypeScriptWorker) => { self.extendTSWorkerFactory = (TypeScriptWorker) => {
return class MonacoTSWorker extends TypeScriptWorker { return class MonacoTSWorker extends TypeScriptWorker {

Loading…
Cancel
Save