Skip to content

fix(typia): avoid panic on qualified JSDoc parameter names#1861

Open
samchon wants to merge 3 commits into
masterfrom
fix/jsdoc-qualified-name-panic
Open

fix(typia): avoid panic on qualified JSDoc parameter names#1861
samchon wants to merge 3 commits into
masterfrom
fix/jsdoc-qualified-name-panic

Conversation

@samchon
Copy link
Copy Markdown
Owner

@samchon samchon commented May 19, 2026

Summary

  • metadata_js_doc_parameter_name previously called .Text() directly on the JSDoc tag's Name(). For nested parameter names like @param obj.field description, the parser produces a QualifiedName, which upstream typescript-go's (*Node).Text() switch does not handle — it panics with Unhandled case in Node.Text: *ast.QualifiedName.
  • Route the name through nativeast.NodeText, the ttsc shim that covers QualifiedName and other DeclarationName kinds the upstream switch misses. The shim is also nil-safe, so the explicit nil guard is no longer needed.

Test plan

  • pnpm test:go
  • go test -tags typia_native_internal ./... from packages/typia/test
  • pnpm test (full suite, since the transform path is touched)

🤖 Generated with Claude Code

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]>
Copilot AI review requested due to automatic review settings May 19, 2026 15:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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’s Name().
  • Remove the explicit nil guard for Name() based on the shim helper’s nil-safety.
  • Add inline documentation explaining the QualifiedName panic scenario and rationale.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

samchon and others added 2 commits May 20, 2026 00:34
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants