-
-
Notifications
You must be signed in to change notification settings - Fork 62
Description
The encoding/json package states:
Embedded struct fields are usually marshaled as if their inner exported fields were fields in the outer struct, subject to the usual Go visibility rules amended as described in the next paragraph. An anonymous struct field with a name given in its JSON tag is treated as having that name, rather than being anonymous. An anonymous struct field of interface type is treated the same as having that type as its name, rather than being anonymous.
Which means that the following code
type A struct {
A string
}
type B struct {
A
Foo string
}Should be converted to
export interface A {
A: string;
}
export interface B extends A { // This implies there is a `A: string` field
Foo string;
}But it is instead converted into
export interface B {
Foo string;
A: A;
}This means that the generated typescript cannot deal with embedded types correctly.
Edit: I see now that tstype:",extends"exists, I just reckon it should be the default or there should be a way to make it the default.