Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 81e20c0

Browse files
j-f1JamesHenry
authored andcommitted
Fix: Only warn about an unsupported TypeScript version once (#347)
1 parent 5e22fac commit 81e20c0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

parser.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const ACTIVE_TYPESCRIPT_VERSION = ts.version;
1717
const isRunningSupportedTypeScriptVersion = semver.satisfies(ACTIVE_TYPESCRIPT_VERSION, SUPPORTED_TYPESCRIPT_VERSIONS);
1818

1919
let extra;
20+
let warnedAboutTSVersion = false;
2021

2122
/**
2223
* Resets the extra config object
@@ -99,11 +100,13 @@ function parse(code, options) {
99100
*/
100101
if (typeof options.loggerFn === "function") {
101102
extra.log = options.loggerFn;
103+
} else if (options.loggerFn === false) {
104+
extra.log = Function.prototype;
102105
}
103106

104107
}
105108

106-
if (!isRunningSupportedTypeScriptVersion) {
109+
if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) {
107110
const border = "=============";
108111
const versionWarning = [
109112
border,
@@ -115,6 +118,7 @@ function parse(code, options) {
115118
border
116119
];
117120
extra.log(versionWarning.join("\n\n"));
121+
warnedAboutTSVersion = true;
118122
}
119123

120124
// Even if jsx option is set in typescript compiler, filename still has to

0 commit comments

Comments
 (0)