FlattenFunction
Flattens unions, intersections and tables inside function parameter and return types.
Params
Name | Type | Description |
---|---|---|
input | (...any) -> (...any) | The function to flatten. |
Example
luau
type Result = FlattenFunction<(string | (number | boolean)) -> (any & (boolean & number))>
-- type Result = (boolean | number | string) -> any & boolean & number
CleanFunction
Removes duplicate components / properties from function param and return types.
Params
Name | Type | Description |
---|---|---|
input | (...any) -> (...any) | The function to clean. |
Example
luau
type Result = CleanFunction<(number, string | string | boolean) -> any | any>
-- type Result = (number, boolean | string) -> any
Params
Gets the parameters for a function.
Params
Name | Type | Description |
---|---|---|
input | (...any) -> (...any) | The function to get params for. |
Example
luau
type Result = Params<(number, string, boolean, ...{ any }) -> any>
--[[
type Result = {
1: number,
2: string,
3: boolean,
tail: {any}
}
]]
Returns
Gets the return types for a function.
Params
Name | Type | Description |
---|---|---|
input | (...any) -> (...any) | The function to get return types for. |
Example
luau
type Result = Returns<() -> (string, number)>
-- type Result = { 1: string, 2: number }