Skip to content

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Oct 16, 2025

Inspired by #53

This is an opt-in feature to be backwards compatible.

To use:

gen, _ := guts.NewGolangParser()

// PreserveComments will attach golang comments to the typescript nodes.
gen.PreserveComments()

Example:

// Foo is the structure to contain things
type Foo struct {
	Bar string // Bar is important
	// Bazz is less important but has more comments
	// associate with it.
	Bazz int
}
// From comments/comments.go
// Foo is the structure to contain things
export interface Foo {
    readonly Bar: string; // Bar is important
    // Bazz is less important but has more comments
    // associate with it.
    readonly Bazz: number;
}

Limitations

This PR only covers a subset of cases right now. More will have to be added

@Emyrk
Copy link
Member Author

Emyrk commented Oct 16, 2025

@stavros-k I think this might cover most of your use case? I think I'll merge and release this as is, and improve on it over time.

@stavros-k
Copy link
Contributor

Looks good yea! Thanks

@Emyrk Emyrk merged commit 3f5ec56 into main Oct 16, 2025
1 check passed
@Emyrk
Copy link
Member Author

Emyrk commented Oct 16, 2025

@stavros-k I made a new release of guts with this change 👍

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