Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions config/mutations.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,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,
})
})
}
Expand Down
29 changes: 29 additions & 0 deletions testdata/interfacetotype-comments/interfacetotype-comments.go
Original file line number Diff line number Diff line change
@@ -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"`
}
48 changes: 48 additions & 0 deletions testdata/interfacetotype-comments/interfacetotype-comments.ts
Original file line number Diff line number Diff line change
@@ -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;
};
1 change: 1 addition & 0 deletions testdata/interfacetotype-comments/mutations
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
InterfaceToType,ExportTypes,ReadOnly