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

Allow assigning untyped objects to struct properties #103

Open
benStre opened this issue May 12, 2024 · 0 comments
Open

Allow assigning untyped objects to struct properties #103

benStre opened this issue May 12, 2024 · 0 comments

Comments

@benStre
Copy link
Member

benStre commented May 12, 2024

Currently, nested structs can be created with normal objects, e.g.

const example = MyStruct({
  name: 1,
  address: {
    street: "xy"
  }
})

But when assigning a new object to a property, an error occurs:

example.address = {street: "z"}; // Error: address must be of type <MyAddress>

It should be possible to assign objects without explicitly converting them to the matching type beforehand.

@benStre benStre changed the title Allow assigning normal objects to struct properties Allow assigning untyped objects to struct properties May 12, 2024
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