Fix ts.transpileDeclaration having empty sourceMapText when declarationMap is true#59314
Conversation
MichaelMitchell-at
left a comment
There was a problem hiding this comment.
I've verified this fixes the issue for my use case, but I'm not sure how to write a test for this. I didn't find any existing tests that I could use as a reference.
cc @weswigham
| affectsBuildInfo: true, | ||
| showInSimplifiedHelpView: true, | ||
| category: Diagnostics.Emit, | ||
| transpileOptionValue: undefined, |
There was a problem hiding this comment.
This being set to undefined caused declarationMap to be set to undefined in options
TypeScript/src/services/transpile.ts
Lines 130 to 137 in f37482c
| } | ||
| // Emit | ||
| const result = program.emit(/*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnlyDtsFiles*/ declaration, transpileOptions.transformers, /*forceDtsEmit*/ declaration); | ||
| const result = program.emit(/*targetSourceFile*/ undefined, /*writeFile*/ undefined, /*cancellationToken*/ undefined, /*emitOnly*/ undefined, transpileOptions.transformers, /*forceDtsEmit*/ undefined); |
There was a problem hiding this comment.
Before we were passing true to forceDtsEmit, which caused this to evaluate to false:
TypeScript/src/compiler/emitter.ts
Line 907 in f37482c
though I'm not sure if this is actually the correct fix. Perhaps it would be to just remove
!forceDtsEmit && from emitter.ts.
Changing emitOnlyDtsFiles to undefined actually doesn't seem to matter, at least with the configuration I tested with, which seems kind of surprising.
There was a problem hiding this comment.
Well, no permutation of what I said results in all the tests passing, so clearly not as easy of a fix as I hoped.
|
Closing in favor of #59337 |
Fixes #59313