Type Inference Modes - piravelha/TheLuauGuide GitHub Wiki
Type Inference Modes allow you to specify how strict you want the Type Checker to be.
There are currently three modes of Type Inference:
--!nocheck
Disables the Type Checker completely.
--!nonstrict
Default, infers the type of every variable that cannot be figured out early as any.
For example, if you declare a variable but not initialize it, the Type Checker will mark it as any:
local var
var = 1 -- var is `any`
var = "Hello World" -- var is still `any`
--!strict
Similar to --!nonstrict, but will try to infer the type for every single variable.
So, the following code snippet will work as shown:
local var -- declared as `unknown`
var = 1 -- var is locked to `number`
var = "Hello World" -- var is now a number, so assigning a string is not possible