Luau is our new language that you can read more about at https://luau-lang.org.
It’s been a bit of a quiet month. We mostly have small optimizations and bug fixes for you.
You can now define functions on sealed tables that have string indexers. These functions will be type-checked against the indexer type. For example, the following is now valid:
local a : {[string]: () -> number} = {}
function a.y() return 4 end -- OK
Autocomplete will now provide string literal suggestions for singleton types, for example:
local function f(x: "a" | "b") end
f("_") -- suggest "a" and "b"
Improve error recovery in the case where we encounter a type pack variable in a place where one is not allowed, for example: type Foo<A...> = { value: A... }
Error feedback has been improved when code does not pass enough arguments to a variadic function.
For example, the following script now produces a much nicer error message:
type A = { [number]: number }
type B = { [number]: string }
local a: A = { 1, 2, 3 }
-- ERROR: Type 'A' could not be converted into 'B'
-- caused by:
-- Property '[indexer value]' is not compatible. Type 'number' could not be converted into 'string'
local b: B = a
If the following code were to error because Hello
was undefined, we would erroneously include the comment in the span of the error. This is now fixed.
type Foo = Hello -- some comment over here
Fixed a crash that could occur when strict scripts have cyclic require() dependencies.
Added an option to autocomplete to cause it to abort processing after a certain amount of time has elapsed.