Preserve original comments on params in dts generated by pseudo type node builder under removeComments: false#3263
Conversation
…node builder under removeComments: false
| parameter.DotDotDotToken != nil, | ||
| e.Name(), | ||
| e.AsParameterDeclaration().QuestionToken != nil || e.AsParameterDeclaration().Initializer != nil, | ||
| ch.typeFromParameter(e.AsParameterDeclaration()), | ||
| parameter.QuestionToken != nil || parameter.Initializer != nil, |
There was a problem hiding this comment.
At some level, why even have any of these if we are ferrying along the declaration?
(Or, why not just use p.Name.Parent more above?)
There was a problem hiding this comment.
At some level, why even have any of these if we are ferrying along the declaration?
ye, u are right here - since the new addition most of those other fields can just be read directly from the Declaration. I made that change.
Or, why not just use p.Name.Parent more above?
I thought about that but that felt indirect and not matching the style of all of those other fields on pseudochecker structs
|
At some level, I wonder if this is even worth it. |
Fair. However, those are kinda jsdoc-like and And the dts emitter configures the printer with |
2a94731 to
da2b88f
Compare
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates pseudo-parameter serialization so parameter-level comment ranges are preserved (and reflected in expected baselines) when emitting ES2015 output.
Changes:
- Reintroduces parameter inline comments in the
commentsFunction(target=es2015)baseline output. - Updates pseudo-parameter node building to derive rest/optional/name from the original declaration and to set comment ranges on emitted parameters.
- Minor formatting change in
PseudoParameterstruct.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| testdata/baselines/reference/submoduleAccepted/compiler/commentsFunction(target=es2015).js.diff | Removes an accepted reference baseline diff file for the commentsFunction ES2015 case. |
| testdata/baselines/reference/submodule/compiler/commentsFunction(target=es2015).js | Updates baseline output to include inline parameter comments. |
| internal/pseudochecker/type.go | Adjusts struct field spacing/alignment for PseudoParameter.Type. |
| internal/checker/pseudotypenodebuilder.go | Builds parameter declarations from p.Declaration and applies comment ranges; updates optional detection in comparisons. |
Comments suppressed due to low confidence (1)
testdata/baselines/reference/submoduleAccepted/compiler/commentsFunction(target=es2015).js.diff:1
- This file is deleted entirely. If the test harness expects an 'accepted' reference baseline for this case, removing it can break baseline comparisons/CI. If the intent is to update the accepted output, consider keeping the file and updating its contents (or regenerating baselines consistently across both
submoduleandsubmoduleAcceptedtrees) rather than deleting just this reference.
No description provided.