custom-worker.js 392 B

123456789101112
  1. self.extendTSWorkerFactory = (TypeScriptWorker) => {
  2. return class MonacoTSWorker extends TypeScriptWorker {
  3. // Adds a custom function to the webworker
  4. async getDTSEmitForFile(fileName) {
  5. const result = await this.getEmitOutput(fileName)
  6. const firstDTS = result.outputFiles.find(o => o.name.endsWith(".d.ts"))
  7. return (firstDTS && firstDTS.text) || ""
  8. }
  9. }
  10. }