StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Don't remove parenthesis in `Rest...` generics.

Open howmanysmall opened this issue 1 year ago • 0 comments

I don't really know how to explain this but I do have a reproduction.

-- Given this type:
type Function<T..., R...> = any

do
    type ThisIsOkay = Function<(), ({[string]: number})>
    type ThisIsInvalidAndWhatResultsFromFormatting = Function<(), {[string]: number}>
end

do
    type ThisIsOkay2 = Function<(string), ({[string]: number})>
    type ThisIsInvalidAndWhatResultsFromFormatting2 = Function<string, {[string]: number}>
end

Basically, if there's two Rest... generics in a type, you should not format away the parenthesis for any of them.

howmanysmall avatar Aug 15 '24 23:08 howmanysmall