Say I declare the --!strict type inference mode, why does the script compile and run even though there are errors, and is there a way to combat this problem?
Source: Type checking - Luau
Say I declare the --!strict type inference mode, why does the script compile and run even though there are errors, and is there a way to combat this problem?
Source: Type checking - Luau
Do you mean something such as this?
--!strict
local function add(a: number, b: number) : number
return a + b
end
local x = add(10, "string")
-- warns in the editor
-- errors during runtime
The Luau Type Checker doesn’t interfere with how the script is compiled (To an extent)
As far as I know, type checking is limited to the editor right now. It doesn’t affect compilation yet to avoid weird bugs.