From a077056c8d0fd07aeae16920b98bff4d6e4349d4 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 Nov 2023 16:24:50 -0800 Subject: [PATCH 1/3] Transpile jsdoc parsing mode Fixes #56625 --- src/services/transpile.ts | 7 ++++++- tests/baselines/reference/api/typescript.d.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 9637387afa093..c17960716dc27 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -36,6 +36,7 @@ export interface TranspileOptions { moduleName?: string; renamedDependencies?: MapLike; transformers?: CustomTransformers; + jsDocParsingMode?: JSDocParsingMode; } export interface TranspileOutput { @@ -121,7 +122,11 @@ export function transpileModule(input: string, transpileOptions: TranspileOption languageVersion: getEmitScriptTarget(options), impliedNodeFormat: getImpliedNodeFormatForFile(toPath(inputFileName, "", compilerHost.getCanonicalFileName), /*packageJsonInfoCache*/ undefined, compilerHost, options), setExternalModuleIndicator: getSetExternalModuleIndicator(options), - jsDocParsingMode: JSDocParsingMode.ParseNone, + jsDocParsingMode: transpileOptions.jsDocParsingMode !== undefined ? + transpileOptions.jsDocParsingMode : + transpileOptions.transformers ? + JSDocParsingMode.ParseAll : + JSDocParsingMode.ParseNone, }, ); if (transpileOptions.moduleName) { diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index b051e45f6081a..a55b003f6c8db 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -11618,6 +11618,7 @@ declare namespace ts { moduleName?: string; renamedDependencies?: MapLike; transformers?: CustomTransformers; + jsDocParsingMode?: JSDocParsingMode; } interface TranspileOutput { outputText: string; From 4f556e3ca695eb035543052f98ebfb23aa4616cf Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 Nov 2023 17:09:07 -0800 Subject: [PATCH 2/3] Update src/services/transpile.ts --- src/services/transpile.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/services/transpile.ts b/src/services/transpile.ts index c17960716dc27..83d74cd320304 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -124,8 +124,6 @@ export function transpileModule(input: string, transpileOptions: TranspileOption setExternalModuleIndicator: getSetExternalModuleIndicator(options), jsDocParsingMode: transpileOptions.jsDocParsingMode !== undefined ? transpileOptions.jsDocParsingMode : - transpileOptions.transformers ? - JSDocParsingMode.ParseAll : JSDocParsingMode.ParseNone, }, ); From 9a75d6da9cd99d628c80b09d854ad6e7cd1fea67 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Thu, 30 Nov 2023 17:11:25 -0800 Subject: [PATCH 3/3] Update src/services/transpile.ts --- src/services/transpile.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/services/transpile.ts b/src/services/transpile.ts index 83d74cd320304..0b708e6282635 100644 --- a/src/services/transpile.ts +++ b/src/services/transpile.ts @@ -122,9 +122,7 @@ export function transpileModule(input: string, transpileOptions: TranspileOption languageVersion: getEmitScriptTarget(options), impliedNodeFormat: getImpliedNodeFormatForFile(toPath(inputFileName, "", compilerHost.getCanonicalFileName), /*packageJsonInfoCache*/ undefined, compilerHost, options), setExternalModuleIndicator: getSetExternalModuleIndicator(options), - jsDocParsingMode: transpileOptions.jsDocParsingMode !== undefined ? - transpileOptions.jsDocParsingMode : - JSDocParsingMode.ParseNone, + jsDocParsingMode: transpileOptions.jsDocParsingMode ?? JSDocParsingMode.ParseNone, }, ); if (transpileOptions.moduleName) {