Omit
Returns a subset of a type without specified components / properties.
Params
Name | Type | Description |
---|---|---|
input | any | The type to omit from. |
to_omit | any | The components / properties to omit. |
Example
luau
type Result = Omit<
"hello" | "world" | "foo" | "bar",
"world" | "bar"
>
-- type Result = "foo" | "hello"
Pick
Returns a subset of a type with only specified components / properties.
Params
Name | Type | Description |
---|---|---|
input | any | The type to pick from. |
to_pick | any | The components / properties to pick. |
Example
luau
type Result = Pick<
"hello" & "world" & "foo" & "bar",
"world" | "bar"
>
-- type Result = "bar" & "world"
Flatten
Combines a nested union or intersection into one union / intersection. Combines an intersection of tables into one consolidated table whilst preserving semantics.
Params
Name | Type | Description |
---|---|---|
input | any | The type to flatten. |
Example
luau
type Result = Flatten<({ hello: "world" } & ({ foo: "bar" } | { lol: "kek" }))>
--[[
type Result = {
foo: "bar",
hello: "world"
} | {
hello: "world",
lol: "kek"
}
]]
Clean
Removes duplicate components / properties from a type.
Params
Name | Type | Description |
---|---|---|
input | any | The type to clean. |
Example
luau
type Result = Clean<{
age: number | number,
[boolean]: boolean | boolean
}>
--[[
type Result = {
[boolean]: boolean,
age: number
}
]]