"Unknown global" type error using --!strict

I’m not using Luau type checking due to illogical errors.
Today I tested a simple thing:

--!strict
a = 1

I get:

Type Error: (2,1) Unknown global 'a'

In my case, I have to declare my variable without local due to this error:

So how to declare a global variable without getting this error when using --!strict?

So you didn’t use?

local a = 1

You didn’t read my question.


Sorry, but why did you call it --!strict?

1 Like

You are forced to set types on all variables if strict is enabled.

a: number = 1

1 Like

Did you test it before?

Syntax Error: (2,1) Expected '(', '{' or <string> when parsing function call, got '='