Skip to content

Commit

Permalink
fix: handle diagnostics object in getEmitOutput
Browse files Browse the repository at this point in the history
* diagnostics object in ts.EmitOutput is internal but needs to be processed in order to be serializable
  • Loading branch information
Carlosamouco authored and cmsamouco committed Apr 10, 2024
1 parent 8503aef commit cd977b8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/language/typescript/tsWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,16 @@ export class TypeScriptWorker implements ts.LanguageServiceHost, ITypeScriptWork
if (fileNameIsLib(fileName)) {
return { outputFiles: [], emitSkipped: true };
}
return this._languageService.getEmitOutput(fileName);
const emitOutput = this._languageService.getEmitOutput(fileName);

// 'diagnostics' object is internal in ts.EmitOutput
if ('diagnostics' in emitOutput) {
emitOutput.diagnostics = TypeScriptWorker.clearFiles(
emitOutput.diagnostics as ts.Diagnostic[]
);
}

return emitOutput;
}

async getCodeFixesAtPosition(
Expand Down

0 comments on commit cd977b8

Please sign in to comment.