message: Catch syntax errors even when calling transpileModule
diff: @@ -30,8 +30,34 @@ function transpileViaTranspileModile(
  fileSource: string,
  compilerOptions: ts.CompilerOptions,
  ): ts.TranspileOutput {
  - return ts.transpileModule(fileSource, {
  + const transpileOutput = ts.transpileModule(fileSource, {
  compilerOptions,
  fileName: filePath,
  + reportDiagnostics: true,
  });
  + const {diagnostics} = transpileOutput;
  +
  + if (diagnostics.length > 0) {
  + const errors = formatDiagnostics(diagnostics);
  + logOnce(logMessageForTranspilationErrors(errors));
  + // Maybe we should keep compiling even though there are errors. This can possibly be configured.
  + throw createTranspilationError(errors);
  + }
  +
  + return transpileOutput;
  +}
  +
  +function formatDiagnostics(diagnostics: ts.Diagnostic[]): string {
  + // TODO consider using ts.formatDiagnosticsWithColorAndContext()
  + return `${diagnostics.map(d => d.messageText)}\n`;
  +}
  +
  +function createTranspilationError(errors: string): Error {
  + return Error(
  + `TSC language server encountered errors while transpiling. Errors: ${errors}`,
  + );
  +}
  +
  +function logMessageForTranspilationErrors(errors: string): string {
  + return `Diagnostic errors from TSC: ${errors}`;
  }
  