Skip to content

Commit

Permalink
Add version checking condition
Browse files Browse the repository at this point in the history
  • Loading branch information
samchon committed Nov 21, 2023
1 parent 207ffc3 commit 7c58cd6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions projects/core/src/patch/patch-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
);
}
Expand Down

0 comments on commit 7c58cd6

Please sign in to comment.