From 7c58cd64370535abda351d3903e201d4a57f983d Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 22 Nov 2023 02:18:50 +0900 Subject: [PATCH] Add version checking condition --- projects/core/src/patch/patch-module.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/projects/core/src/patch/patch-module.ts b/projects/core/src/patch/patch-module.ts index 49d54ef..0e8f928 100644 --- a/projects/core/src/patch/patch-module.ts +++ b/projects/core/src/patch/patch-module.ts @@ -96,13 +96,20 @@ export function patchModule(tsModule: TsModule, skipDts: boolean = false): { js: printableFooters.push(`tsp.${execTscCmd}();`); } - if (tsModule.moduleName === 'tsc.js') { - const tscSection = source.body.find(s => s.sourceText.includes('var defaultJSDocParsingMode = 2')); + /* Patch defaultJSDocParsingMode */ + if ( + tsModule.moduleName === "tsc.js" && + ((tsModule.majorVer === 5 && tsModule.minorVer >= 3) || + tsModule.majorVer > 5) + ) { + const tscSection = source.body.find((s) => + s.sourceText.includes("var defaultJSDocParsingMode = 2"), + ); if (tscSection) { tscSection.updateSourceText( tscSection.sourceText.replace( - 'var defaultJSDocParsingMode = 2', - 'var defaultJSDocParsingMode = 0', + "var defaultJSDocParsingMode = 2", + "var defaultJSDocParsingMode = 0", ), ); }