How to unpack type?

Hi, I don’t know how to explain this well, but is there a way to do something like this?

type button = {
 Name: string,
 Boolean: Boolean,
 Cool: Boolean,
}

type something = {
 unpack(button), --this would add the Name, Boolean, and Cool
 AddedThing: any,
 AnotherThing: any
}
2 Likes

If you mean combining two types together, you can use the & symbol between two different types:

type something = button & {
    whatever: any,
}

Read more about it here:

2 Likes

Oh I’m so dumb :smile:
Thanks a lot!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.