OmitUnion
Returns a subset of a union without specified components.
Params
Name | Type | Description |
---|---|---|
input | any | The union to omit from. |
to_omit | any | The components to omit. |
Example
luau
type Result = OmitUnion<
"hello" | string | "world",
"world"
>
-- type Result = "hello" | string
PickUnion
Returns a subset of a union with only specified components.
Params
Name | Type | Description |
---|---|---|
input | any | The union to pick from. |
to_pick | any | The components to pick. |
Example
luau
type Result = PickUnion<
"hello" | string | "world",
"world"
>
-- type Result = "world"
FlattenUnion
Recursively combines nested unions into one union.
Params
Name | Type | Description |
---|---|---|
input | any | The union to flatten. |
Example
luau
type Result = FlattenUnion<"foo" | ("hello" | ("world" | "lol"))>
-- type Result = "foo" | "hello" | "lol" | "world"
CleanUnion
Removes duplicate types from a union.
Params
Name | Type | Description |
---|---|---|
input | any | The union to clean. |
Example
luau
type Result = CleanUnion<"hello" | string | "world" | string | "foo" | "hello">
-- type Result = "foo" | "hello" | "world" | string