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

Only warn about an unsupported TypeScript version once #347

Merged
merged 6 commits into from
Aug 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down