mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Update trackable-types.md
This commit is contained in:
parent
8df9d8c1da
commit
446fa87f74
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ When it comes to syntax, it could make sense to allow defining these trackable t
|
|||
function f<type = nil>() --[[code]] end
|
||||
```
|
||||
|
||||
This doesn't work when writing code outside a function. Also, this forces everything to be tracked - if variable A and B have the types `number | type`, only one of them changing would be sufficient to change the type of the other variable. All of them are tracked; whereas with the suggested syntax, it is possible to track just one of them.
|
||||
This doesn't work when writing code outside a function. Also, this forces everything to be tracked - if two variables have types related to `type`, only one of them changing would be sufficient to change the type of the other variable. All of them are tracked; whereas with the suggested syntax, it is possible to track just one of them.
|
||||
|
||||
Another syntax is to use `:` instead of `=`. Another one is to use intersection syntax to initialize, like this:
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue