diff --git a/parser.js b/parser.js index 944606e..250eebd 100644 --- a/parser.js +++ b/parser.js @@ -17,6 +17,7 @@ const ACTIVE_TYPESCRIPT_VERSION = ts.version; const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS); let extra; +let warnedAboutTSVersion = false; /** * Resets the extra config object @@ -99,11 +100,13 @@ function parse(code, options) { */ if (typeof options.loggerFn === "function") { extra.log = options.loggerFn; + } else if (options.loggerFn === false) { + extra.log = Function.prototype; } } - if (!isRunningSupportedTypeScriptVersion) { + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { const border = "============="; const versionWarning = [ border, @@ -115,6 +118,7 @@ function parse(code, options) { border ]; extra.log(versionWarning.join("\n\n")); + warnedAboutTSVersion = true; } // Even if jsx option is set in typescript compiler, filename still has to