news-2021-05-31-luau-recap-may-2021.md
May 31, 2021
This month we have added a new small feature to the language and spent a lot of time improving our typechecker.
We’ve updated Luau syntax to support optional names of arguments inside function types. The syntax follows the same format as regular function argument declarations: (a: number, b: string)
Names can be provided in any place where function type is used, for example:
Variadic arguments cannot have an extra name, they are already written as …: number.
These names are used for documentation purposes and we also plan to display them in Roblox Studio auto-complete and type hovers. They do not affect how the typechecking of Luau scripts is performed.
Speaking of typechecking, we’ve implemented many improvements this month:
table.insert function signatureWe’ve also added new checks to our linter:
find/match calls via : when object type is known to be a stringWe also fixed one of the sources for “Free types leaked into this module’s public interface” error message and we are working to fix the remaining ones.
As usual, typechecking improvements will not break execution of your games even if new errors get reported.
We continue to improve our built-in support for auto-complete that will be used in future Roblox Studio updates and will make it easier to implement custom extensions for applications that support Language Server Protocol.
As part of this work we will improve the type information provided by Roblox APIs to match actual arguments and results.
When a relational comparison fails at runtime, the error message now specifies the comparison direction (e.g. attempt to compare nil <= number)
t["name"]