Preserve typedef comments in declaration emit#4365
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix behavior difference for typedef comments in tsgo
Preserve typedef comments in declaration emit
Jun 18, 2026
hkleungai
reviewed
Jun 18, 2026
Comment on lines
-141
to
-153
| /** | ||
| * @overload evaluate(options = {}, [callback]) | ||
| * Evaluate something | ||
| * @note Something interesting | ||
| * @param options [map] | ||
| * @return [string] returns evaluation result | ||
| * @return [null] returns nothing if callback provided | ||
| * @callback callback function (error, result) | ||
| * If callback is provided it will be called with evaluation result | ||
| * @param error [Error] | ||
| * @param result [String] | ||
| * @see callback | ||
| */ |
There was a problem hiding this comment.
Looks like this diff should not go away?
Comment on lines
-38
to
-41
| /** | ||
| * @typedef {Record<Keyword, ParamValueTyped>} ParamStateRecord a Record containing | ||
| * keyword pairs with descriptions of parameters under governance. | ||
| */ |
There was a problem hiding this comment.
Now I am a bit confused..
Which actually counts as the comment for the generated type? The one on top of typedef, or the one follows right after the jsdoc declaration? Or both? Any precedence?
It worths to check how TS 6 behaves in all these cases. 🤔
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JSDoc descriptions preceding
@typedefwere not attached to the emitted declaration type. The full source JSDoc block could instead be emitted separately after the generated type.Declaration emit
@typedef/@callbacksource comments as standalone declaration trivia.Baselines
Example output now matches the intended declaration shape: