Composition #37
Closed
ahmed-adly-khalil
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
type Animal struct {
Sound string
}
type Dog struct {
Animal `tstype:",extends"`
Breed string
} export interface Animal {
Sound: string;
}
export interface Dog extends Animal {
Breed: string;
} docs: https://github.com/gzuidhof/tygo/tree/342962e8fe07318cb925af45c3f804e8c9fcb930#inheritance |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
the following structure would be serialized to JSON as a flat object if we use the standard library,
however in tygo we have to add
json:"animal"
to the Dog type in order to serialize it and this would result in a field representation, is there a way to tell tygo to merge the composed struct fields with the main struct?Beta Was this translation helpful? Give feedback.
All reactions