mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Update constrained-generics.md
This commit is contained in:
parent
9a4225210f
commit
49822e765c
1 changed files with 8 additions and 0 deletions
|
@ -52,6 +52,14 @@ Enum {"None", "Some", "All"} -- Not OK (generic must be have string keys)
|
|||
Enum(0) -- Not ok (generic must be a table)
|
||||
```
|
||||
|
||||
Finally, this will also give the autocomplete the correct information about the Enum, correctly containing the "None", "Some" and "All" keys
|
||||
```lua
|
||||
Enum. --> GetEnumItems: (Enum) -> {None: number, Some: number, All: number}
|
||||
--> None: number
|
||||
--> Some: number
|
||||
--> All: number
|
||||
```
|
||||
|
||||
## Drawbacks
|
||||
|
||||
More of the complexity budget spent.
|
||||
|
|
Loading…
Add table
Reference in a new issue