Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedded structs #60

Closed
jetaggart opened this issue Jun 21, 2024 · 1 comment
Closed

Embedded structs #60

jetaggart opened this issue Jun 21, 2024 · 1 comment

Comments

@jetaggart
Copy link

If I have a struct embedded such as

type A struct {
  FieldA string `json:"fieldA"`
}

type B struct {
  A
  FieldB string `json:"fieldB"`
}

This will product the json:

{"fieldA": "abc", "fieldB": "123"}

However the tygo type looks like this:

export interface A {
  fieldA: string;
}
export interface B {
  A: A;
  fieldB: string;
}

which is incorrect. Is there a way to get it to understand the embedded struct is flattened in the json?

@jetaggart
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant