Unwrapping / extending inline structs
lxnre-codes opened this issue · comments
Lanre commented
Structs that are tagged as inline
should be unwrapped.
// Input
type Vehicle struct {
Category string `json:"category"`
Make string `json:"make"`
}
type Toyota struct {
Vehicle ` json:",inline" tstype:",inline"`
Year int `json:"year"`
}
//Output
interface Vehicle {
category: string;
make: string;
}
interface Toyota extends Vehicle {
year: number;
}
//Or
interface Toyota {
category: string;
make: string;
year: number;
}
Guido Zuidhof commented
I think this is the same underlying challenge as in #15. It can definitely be done, but the current tygo transpiler is single pass, which makes this tricky (if not impossible).
Guido Zuidhof commented
Shipped with #30, thank you @0x-buidl