Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Generic Type Pack Defaults with Single Values Get Broken #1038

@dev-alastair

Description

@dev-alastair

Stylua causes a type error here:

type Object<T... = (nil)> = {
	method: (T...) -> (),
}

Here, (nil) represents a type pack of one element, which is the default for the generic type pack T.... Stylua removes the brackets around nil, meaning it is no longer a type pack and becomes a single type: assigning a type as the default value of a type pack is a type error.

Setting the default value of a type pack to (nil) is often useful for types which should support variadic behaviours, but mostly don't need them, and you don't want to clutter up your code with Object<T...> everywhere.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingluauFormatting related to Luau

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions