Struct Array Alias
przemeklach opened this issue · 1 comments
przemeklach commented
Hi,
Given a struct:
type DeviceListing struct {
Identifier string `json:"identifier"`
AccountIdentifier string `json:"accountIdentifier"`
ContactEmail string `json:"contactEmail"`
}
I create two other alias structs:
type CreateListingResponse DeviceListing
type GetDeviceListingsResponse []DeviceListing
The CreateListingResponse Typescript interface is created correctly; however, for GetDeviceListingsResponse it just outputs:
export interface GetDeviceListingsResponse {
}
mozey commented
As per the README: "Only fields with a valid json tag will be converted to TypeScript models"
So you have to declare the list type like this
type GetDeviceListingsResponse struct {
DeviceListing []DeviceListing `json:"deviceListing"`
}