From 4239bc3f352c5ab5af8ac283c3145fbb0d9a22e6 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Thu, 24 May 2018 16:04:55 -0400 Subject: [PATCH] Fix handling for `noEmitOnError: true` --- lib/utilities/compile.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utilities/compile.js b/lib/utilities/compile.js index 0d3eb6a4f..137ecc09f 100644 --- a/lib/utilities/compile.js +++ b/lib/utilities/compile.js @@ -40,7 +40,9 @@ function createWatchCompilerHost(ts, options, project, callbacks) { host.afterProgramCreate = function() { afterCreate.apply(this, arguments); if (callbacks.buildComplete) { - callbacks.buildComplete(); + // Use nextTick to preserve ordering between the `buildComplete` callback + // and the diagnostic hooks below + process.nextTick(() => callbacks.buildComplete()); } };