monaco-editor/test/custom-worker.js
2020-08-21 08:22:27 -04:00

12 lines
392 B
JavaScript

self.extendTSWorkerFactory = (TypeScriptWorker) => {
return class MonacoTSWorker extends TypeScriptWorker {
// Adds a custom function to the webworker
async getDTSEmitForFile(fileName) {
const result = await this.getEmitOutput(fileName)
const firstDTS = result.outputFiles.find(o => o.name.endsWith(".d.ts"))
return (firstDTS && firstDTS.text) || ""
}
}
}