Skip to content

FlattenFunction ​

Flattens unions, intersections and tables inside function parameter and return types.

Params ​

NameTypeDescription
input(...type) -> (...type)The function to flatten.

Example ​

luau
type Result = FlattenFunction<(string | (number | boolean)) -> (type & (boolean & number))>

-- type Result = (boolean | number | string) -> type & boolean & number

CleanFunction ​

Removes duplicate components / properties from function param and return types.

Params ​

NameTypeDescription
input(...type) -> (...type)The function to clean.

Example ​

luau
type Result = CleanFunction<(number, string | string | boolean) -> type | type>

-- type Result = (number, boolean | string) -> type

Params ​

Gets the parameters for a function.

Params ​

NameTypeDescription
input(...type) -> (...type)The function to get params for.

Example ​

luau
type Result = Params<(number, string, boolean, ...{ type }) -> type>

--[[
    type Result = {
        1: number,
        2: string,
        3: boolean,
        tail: {type}
    }
]]

Returns ​

Gets the return types for a function.

Params ​

NameTypeDescription
input(...type) -> (...type)The function to get return types for.

Example ​

luau
type Result = Returns<() -> (string, number)>

-- type Result = { 1: string, 2: number }