From f90b7a69624c6e5206b08a93e5016583f87bbce2 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:33:51 +0200 Subject: [PATCH 1/3] fix comments in mutations --- config/mutations.go | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/config/mutations.go b/config/mutations.go index ae26b43..be944db 100644 --- a/config/mutations.go +++ b/config/mutations.go @@ -125,10 +125,11 @@ func EnumAsTypes(ts *guts.Typescript) { // Replace the enum with an alias type ts.ReplaceNode(key, &bindings.Alias{ - Name: enum.Name, - Modifiers: enum.Modifiers, - Type: union, - Source: enum.Source, + Name: enum.Name, + Modifiers: enum.Modifiers, + Type: union, + Source: enum.Source, + SupportComments: enum.SupportComments, }) }) } @@ -374,11 +375,12 @@ func InterfaceToType(ts *guts.Typescript) { // Replace the interface with a type alias ts.ReplaceNode(key, &bindings.Alias{ - Name: intf.Name, - Modifiers: intf.Modifiers, - Type: typeLiteral, - Parameters: intf.Parameters, - Source: intf.Source, + Name: intf.Name, + Modifiers: intf.Modifiers, + Type: typeLiteral, + Parameters: intf.Parameters, + Source: intf.Source, + SupportComments: intf.SupportComments, }) }) } From b101b6c559e2260941e1762355527348ff5ff9ac Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 19 Jan 2026 17:43:12 +0200 Subject: [PATCH 2/3] revert 1 --- config/mutations.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/config/mutations.go b/config/mutations.go index be944db..d75346e 100644 --- a/config/mutations.go +++ b/config/mutations.go @@ -125,11 +125,10 @@ func EnumAsTypes(ts *guts.Typescript) { // Replace the enum with an alias type ts.ReplaceNode(key, &bindings.Alias{ - Name: enum.Name, - Modifiers: enum.Modifiers, - Type: union, - Source: enum.Source, - SupportComments: enum.SupportComments, + Name: enum.Name, + Modifiers: enum.Modifiers, + Type: union, + Source: enum.Source, }) }) } From 5203a5a2f52b34ca9e15b1468ea50c1035a95ea6 Mon Sep 17 00:00:00 2001 From: Stavros Kois Date: Wed, 21 Jan 2026 20:18:15 +0200 Subject: [PATCH 3/3] add test --- .../interfacetotype-comments.go | 29 +++++++++++ .../interfacetotype-comments.ts | 48 +++++++++++++++++++ testdata/interfacetotype-comments/mutations | 1 + 3 files changed, 78 insertions(+) create mode 100644 testdata/interfacetotype-comments/interfacetotype-comments.go create mode 100644 testdata/interfacetotype-comments/interfacetotype-comments.ts create mode 100644 testdata/interfacetotype-comments/mutations diff --git a/testdata/interfacetotype-comments/interfacetotype-comments.go b/testdata/interfacetotype-comments/interfacetotype-comments.go new file mode 100644 index 0000000..9f568d8 --- /dev/null +++ b/testdata/interfacetotype-comments/interfacetotype-comments.go @@ -0,0 +1,29 @@ +package codersdk + +// User represents a user in the system. +// This comment should be preserved after conversion to a type alias. +type User struct { + // ID is the unique identifier + ID string `json:"id"` + // Name is the user's full name + Name string `json:"name"` + // Email is the user's email address + Email string `json:"email"` +} + +// Address contains location information. +type Address struct { + // Street address + Street string `json:"street"` + // City name + City string `json:"city"` +} + +// Profile combines user and address information. +// It extends multiple types. +type Profile struct { + User + Address + // Bio is the user's biography + Bio string `json:"bio"` +} diff --git a/testdata/interfacetotype-comments/interfacetotype-comments.ts b/testdata/interfacetotype-comments/interfacetotype-comments.ts new file mode 100644 index 0000000..91127e4 --- /dev/null +++ b/testdata/interfacetotype-comments/interfacetotype-comments.ts @@ -0,0 +1,48 @@ +// Code generated by 'guts'. DO NOT EDIT. + +// From codersdk/interfacetotype-comments.go +/** + * Address contains location information. + */ +export type Address = { + /** + * Street address + */ + street: string; + /** + * City name + */ + city: string; +}; + +// From codersdk/interfacetotype-comments.go +/** + * Profile combines user and address information. + * It extends multiple types. + */ +export type Profile = User & Address & { + /** + * Bio is the user's biography + */ + bio: string; +}; + +// From codersdk/interfacetotype-comments.go +/** + * User represents a user in the system. + * This comment should be preserved after conversion to a type alias. + */ +export type User = { + /** + * ID is the unique identifier + */ + id: string; + /** + * Name is the user's full name + */ + name: string; + /** + * Email is the user's email address + */ + email: string; +}; diff --git a/testdata/interfacetotype-comments/mutations b/testdata/interfacetotype-comments/mutations new file mode 100644 index 0000000..92ae551 --- /dev/null +++ b/testdata/interfacetotype-comments/mutations @@ -0,0 +1 @@ +InterfaceToType,ExportTypes,ReadOnly \ No newline at end of file