From b1e3b44df1d8a56c5565d2e5ca31c5be9cd81fc6 Mon Sep 17 00:00:00 2001 From: Anton Gilgur Date: Mon, 6 Jun 2022 20:07:43 -0400 Subject: [PATCH] fix: set noErrors to false when there are compilerOptions errors (#342) - previously, while errors would be printed, the flag for `noErrors` was not set to `false`, and so there would be no yellow warning about errors - this is mostly just fixing asymmetric UX, but personally, I actually have missed this error before myself, so maybe this will help alleviate that --- src/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0dfd856..1730d64 100644 --- a/src/index.ts +++ b/src/index.ts @@ -78,7 +78,6 @@ const typescript: PluginImpl = (options) => if (!pluginOptions.typescript) { pluginOptions.typescript = require("typescript"); } - setTypescriptModule(pluginOptions.typescript); const self: Plugin & { _ongenerate: () => void, _onwrite: (this: PluginContext, _output: OutputOptions) => void } = { @@ -122,8 +121,12 @@ const typescript: PluginImpl = (options) => servicesHost.setLanguageService(service); // printing compiler option errors - if (pluginOptions.check) - printDiagnostics(context, convertDiagnostic("options", service.getCompilerOptionsDiagnostics()), parsedConfig.options.pretty === true); + if (pluginOptions.check) { + const diagnostics = convertDiagnostic("options", service.getCompilerOptionsDiagnostics()); + printDiagnostics(context, diagnostics, parsedConfig.options.pretty === true); + if (diagnostics.length > 0) + noErrors = false; + } if (pluginOptions.clean) cache().clean();