Skip to content

OmitIntersection

Returns a subset of an intersection without specified components.

Params

NameTypeDescription
inputtypeThe intersection to omit from.
to_omittypeThe components to omit.

Example

luau
type Result = OmitIntersection<
    "hello" & string & "world",
    "world"
>

-- type Result = "hello" & string

PickIntersection

Returns a subset of an intersection with only specified components.

Params

NameTypeDescription
inputtypeThe intersection to pick from.
to_picktypeThe components to pick.

Example

luau
type Result = PickIntersection<
    "hello" & string & "world",
    "world"
>

-- type Result = "world"

FlattenIntersection

Combines nested intersections into one intersection.

Params

NameTypeDescription
inputtypeThe intersection to flatten.

Example

luau
type Result = FlattenIntersection<"foo" & ("hello" & ("world" & "lol"))>

-- type Result = "foo" & "hello" & "lol" & "world"

CleanIntersection

Removes duplicate types from an intersection.

Params

NameTypeDescription
inputtypeThe intersection to clean.

Example

luau
type Result = CleanIntersection<"hello" & string & "world" & string & "foo" & "hello">

-- type Result = "foo" & "hello" & "world" & string