-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New cli command
npx typia patch
for hacking `defaultJSDocParsingMod…
…e` value (#883) * Prepare temporary way for `jsDocParsingMode` patch. If `ts-patch` update be delayed for a long time, `typia` will hack the `jsDocParsingMode` by itself. Of course, this is beta plan that would be discarded if `ts-patch` supports TypeScript v5.3 in near time. * Complete documentation
- Loading branch information
Showing
13 changed files
with
112 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import fs from "fs"; | ||
|
||
export namespace TypiaPatchWizard { | ||
export const main = async (): Promise<void> => { | ||
console.log("----------------------------------------"); | ||
console.log(" Typia Setup Wizard"); | ||
console.log("----------------------------------------"); | ||
console.log( | ||
[ | ||
`Since TypeScript v5.3 update, "tsc" no more parses JSDoc comments.`, | ||
``, | ||
`Therefore, "typia" revives the JSDoc parsing feature by patching "tsc".`, | ||
``, | ||
`This is a temporary feature of "typia", and it would be removed when "ts-patch" being updated.`, | ||
].join("\n"), | ||
); | ||
|
||
await patch(); | ||
}; | ||
|
||
export const patch = async (): Promise<void> => { | ||
const location: string = require.resolve("typescript/lib/tsc.js"); | ||
const content: string = await fs.promises.readFile(location, "utf8"); | ||
if (content.indexOf(FROM) === -1) return; | ||
|
||
await fs.promises.writeFile(location, content.replace(FROM, TO), "utf8"); | ||
}; | ||
} | ||
|
||
const FROM = `var defaultJSDocParsingMode = 2 /* ParseForTypeErrors */`; | ||
const TO = `var defaultJSDocParsingMode = 0 /* ParseAll */`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.