-
-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Outline
After TypeScript v5.3 being released, it will no more parse JSDocComments
as default.
To turn it on, ts.Program
instance must be created with ts.CompilerHost.jsDocParsingMode
configuration like below. By the way, transformer libraries can't create the ts.Program
instance by themselves, so if there're some transformer libraries utilizing the JSDocComment
feature, they would be disabled after the TypeScript v5.3 release.
Especially, my library typia be damaged.
const options: ts.CompilerOptions;
const host: ts.CompilerHost = ts.createCompilerHost(options);
const program: ts.Program = ts.createProgram(["source files..."], options, host);
To support those JSDocComment
utilizing transformers, ts-patch
needs to hack the defaultJSDocParsingMode
variable of below.
microsoft/TypeScript#55739 (comment) ->
ts-patch
author @nonara be tagged
Suggestion
I think there can be two options.
- Just hack the
defaultJSDocParsingMode
value globally - Special CLI argument
ts-patch install --jsDoc
The 1st way is to changing the defaultJSDocParsingMode
variable of tsc
to be 0
as default.
Comparing with other fast compilers like swc
and esbuild
, standard TypeScript compiler is hundreds of times slower. Therefore, as transformer library users are already enduring such slower compilation speed, I think they may not consider about the performance enhancement by skipping JsDocComment
parsing.
The 2nd way is to providing special CLI argument ts-patch install --jsDoc
.
Although saving compilation time by ignoring JsDocComment
does not mean for transformer library users, it is the new formal spec of the standard TypeScript compiler. Therefore, rather than changing the defaultJSDocParsingMode
variables globally, it may be more correct to give the user a choice.