Skip to content

Commit

Permalink
Try #134 - defaultJSDocParsingMode of TypeScript v5.3
Browse files Browse the repository at this point in the history
As I don't know how @nonara determines about the `defaultJSDocParsingMode` and have no idea about the caching logic which can be compatible with before TS 5.2, just send a simple PR that changing `defaultJSDocParsingMode` variable value of `tsc.js` to be zero.

Hope @nonara to determine the `defaultJSDocParsingMode` strategy faster, and publish the new version of `ts-patch` for the TypeScript v5.3 update. Thanks for your amazing transformatoin ecosystem contributions.
  • Loading branch information
samchon committed Nov 21, 2023
1 parent 85022ca commit 207ffc3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
"ts-node": "^10.9.1",
"ts-patch": "3.0.0",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.0.4"
"typescript": "^5.3.2"
},
"directories": {
"resources": "./dist/resources"
Expand Down
12 changes: 12 additions & 0 deletions projects/core/src/patch/patch-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ 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'));
if (tscSection) {
tscSection.updateSourceText(
tscSection.sourceText.replace(
'var defaultJSDocParsingMode = 2',
'var defaultJSDocParsingMode = 0',
),
);
}
}

/* Print the module */
const printedJs = printModule();

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3137,10 +3137,10 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==

typescript@^5.0.4:
version "5.1.6"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.6.tgz#02f8ac202b6dad2c0dd5e0913745b47a37998274"
integrity sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==
typescript@^5.3.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.2.tgz#00d1c7c1c46928c5845c1ee8d0cc2791031d4c43"
integrity sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==

uglify-js@^3.1.4:
version "3.17.4"
Expand Down

0 comments on commit 207ffc3

Please sign in to comment.