You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a struct is embedded inside a type, the generated TypeScript definition for that type produces a key/value pair where the key and value are named after the struct, instead of inlining the fields of the struct inside the type.
Here's an example:
tygo.yaml:
- path: 'github.com/Drelf2018/req'
Generated TS output:
// Code generated by tygo. DO NOT EDIT.//////////// source: client.goexportconstOmitempty: string="omitempty";exportconstUserAgent: string="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36 Edg/116.0.1938.54";exportinterfaceClient{Client: any/* http.Client */;BaseURL?: any/* url.URL */;Header: any/* http.Header */;/** * Client will use the value in Variables when the Field's Value starts with "$" */Variables: {[key: string]: any};}//////////// source: encode.goexporttypeMarshaler=any;//////////// source: interfaces.goexporttypeApi=any;exportinterfaceGet{}exportinterfacePost{}exportinterfacePostForm{Post: Post;}exportinterfacePostJson{Post: Post;}exporttypeAdder=any;exporttypeNamedReader=any/* io.Reader */;exporttypeUnwrap=any;exporttypeBeforeRequest=any;//////////// source: task.goexportinterfaceField{/** * index in Api struct */Index: number/* int */[];/** * provided by json tag or parsed from the field name */Key: string;/** * default value used when the field value is zero */Value: string;/** * This field is ignored when it is zero, conflict with default value */Omit: boolean;}exportinterfaceTask{Body: Field[];Files: Field[];Query: Field[];Header: Field[];}exportinterfaceAny{Type: any/* unsafe.Pointer */;Value: any/* unsafe.Pointer */;}
My knowledge of Go is beginner level, so apologies if I got something wrong. If I understand correctly, the type PostForm should be empty in terms of its generated fields (it is composed of Post).
The text was updated successfully, but these errors were encountered:
When a struct is embedded inside a type, the generated TypeScript definition for that type produces a key/value pair where the key and value are named after the struct, instead of inlining the fields of the struct inside the type.
Here's an example:
tygo.yaml:
Generated TS output:
My knowledge of Go is beginner level, so apologies if I got something wrong. If I understand correctly, the type
PostForm
should be empty in terms of its generated fields (it is composed ofPost
).The text was updated successfully, but these errors were encountered: