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.
Stylua causes a type error here:
Here,
(nil)represents a type pack of one element, which is the default for the generic type packT.... Stylua removes the brackets aroundnil, 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 withObject<T...>everywhere.