The type checking warnings are not displayed
tracked
SuzannaLinn Resident
Using strict type checking doesn't display warnings in the Script Warning/Error window
--!strict
local function add(a: number, b: number): number
return a + b
end
local result1: number = add(3, 4) -- Should work fine
local result2: number = add("3", 4) -- Should trigger a type error in strict mode
This code in Luau/Roblox displays this warning:
Type Error: (8,29) Type 'string' could not be converted into 'number'
Log In
Signal Linden
tracked
Signal Linden
This one's a little tricky. The type checker is actually part of
luau-analyze
and not part of the script compiler. We'd have to bundle luau-analyze
into the viewer and get all that plumbed through, and that may take a while.Additionally, we haven't created type packs for any of our functions yet as the user-facing signatures are still kind of in flux. This is particularly true for functions that currently take flat lists with inline "parameter tags" like SetPrimitiveParams and friends. It's not clear that they can be type-checked well in their flat list form. They will probably get a nicer Lua-specific form using key/value pairs that can be correctly type-checked, but we're focusing on getting the fundamentals right first.
For the moment, if you want type checking you can use an external editor that supports Luau. The in-viewer editor is admittedly pretty bare-bones compared to what people'd expect from a modern editor.
WolfGang Senizen
It would be great to have a version of luau-analyze ship with the viewer.