fix(typia): avoid panic on qualified JSDoc parameter names#1861
Open
samchon wants to merge 3 commits into
Open
fix(typia): avoid panic on qualified JSDoc parameter names#1861samchon wants to merge 3 commits into
samchon wants to merge 3 commits into
Conversation
Nested JSDoc parameters like `@param obj.field` parse into a QualifiedName, which upstream's `(*Node).Text()` doesn't handle and panics on. Route the name through the ttsc shim's `NodeText`, which covers QualifiedName and other DeclarationName kinds. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Typia’s Go-based metadata extraction to safely read JSDoc parameter/property names when the TypeScript parser produces QualifiedName nodes (e.g. @param obj.field ...), avoiding a panic caused by calling (*Node).Text() on unsupported name node kinds.
Changes:
- Switch JSDoc parameter/property name extraction to use
nativeast.NodeText(...)instead of calling.Text()on the tag’sName(). - Remove the explicit
nilguard forName()based on the shim helper’s nil-safety. - Add inline documentation explaining the
QualifiedNamepanic scenario and rationale.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reverts the dependency on `nativeast.NodeText`, which is not part of the released [email protected] shim that the smoke build pulls from npm — only the local ttsc working tree has it. Inline the QualifiedName walk so the panic fix doesn't require an unreleased shim helper. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Summary
metadata_js_doc_parameter_namepreviously called.Text()directly on the JSDoc tag'sName(). For nested parameter names like@param obj.field description, the parser produces aQualifiedName, which upstream typescript-go's(*Node).Text()switch does not handle — it panics withUnhandled case in Node.Text: *ast.QualifiedName.nativeast.NodeText, the ttsc shim that coversQualifiedNameand otherDeclarationNamekinds the upstream switch misses. The shim is also nil-safe, so the explicit nil guard is no longer needed.Test plan
pnpm test:gogo test -tags typia_native_internal ./...frompackages/typia/testpnpm test(full suite, since the transform path is touched)🤖 Generated with Claude Code