Skip to content

Conversation

stavros-k
Copy link
Contributor

Add PreserveComments mutation to transfer documentation comments from Go source code to generated TypeScript interfaces and fields.

Features:

  • Extract type-level comments from struct declarations
  • Extract field-level comments from struct fields (both doc and inline)
  • Handle JSON tag field name mapping correctly
  • Preserve original comment formatting and content
  • Optional via PreserveComments mutation (backwards compatible)

Implements comment transfer as requested in GitHub issue #50.

Example:
Go: // User holds info
type User struct {
Name string json:"name" // The name
}

TS: // User holds info
interface User {
// The name
name: string;
}

🤖 Generated with Claude Code

Closes #50

Again, please, please review this. Its LLM Generated as PoC.
Feel free to make any updates or drop this PR and implement differently

Add PreserveComments mutation to transfer documentation comments from
Go source code to generated TypeScript interfaces and fields.

Features:
- Extract type-level comments from struct declarations
- Extract field-level comments from struct fields (both doc and inline)
- Handle JSON tag field name mapping correctly
- Preserve original comment formatting and content
- Optional via PreserveComments mutation (backwards compatible)

Implements comment transfer as requested in GitHub issue coder#50.

Example:
  Go: // User holds info
      type User struct {
        Name string `json:"name"` // The name
      }

  TS: // User holds info
      interface User {
        // The name
        name: string;
      }

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Emyrk
Copy link
Member

Emyrk commented Oct 9, 2025

Sorry for the delay, will get to this mid next week.

@Emyrk
Copy link
Member

Emyrk commented Oct 16, 2025

@stavros-k I am making an attempt here: #59

@Emyrk Emyrk closed this Oct 16, 2025
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.

Transfer comments from Golang to TS.

2 participants