Update typecheck.md

Wording changes in unknown symbols
This commit is contained in:
Arseny Kapoulkine 2020-06-23 09:36:57 -07:00 committed by GitHub
parent 9939c5c361
commit 2cd63aa589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,7 @@ However, in strict mode, the second snippet would be able to infer `number` for
## Unknown symbols
You may see this error a lot, and that's by design even in nonstrict mode.
You may see this error when using custom globals, and that's by design even in nonstrict mode.
Consider how often you're likely to assign a new value to a local variable. What if you accidentally misspelled it? Oops, it's now assigned globally and your local variable is still using the old value.
@ -41,6 +41,8 @@ soeLocal = 2 -- the bug
print(someLocal)
```
Because of this, Luau type checker currently emits an error whenever a non-function global is used; use local variables instead.
## Structural type system
Luau's type system is structural by default, which is to say that we inspect the shape of two tables to see if they are similar enough. This was the obvious choice because Lua 5.1 is inherently structural.