mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Added small bit about syntactic sugar for index type operators
This commit is contained in:
parent
fd8f36cd8a
commit
22e08b7856
1 changed files with 14 additions and 0 deletions
|
@ -119,3 +119,17 @@ Because there are conflicting types for `p` depending on the run time, it is saf
|
||||||
2. If the indexee is an exact table type, fail to reduce and throw an error.
|
2. If the indexee is an exact table type, fail to reduce and throw an error.
|
||||||
|
|
||||||
FYI: exact table type indicates that the table has only the properties listed in its type, and inexact table type indicates that the table has at least the properties listed in its type.
|
FYI: exact table type indicates that the table has only the properties listed in its type, and inexact table type indicates that the table has at least the properties listed in its type.
|
||||||
|
|
||||||
|
Later down the line, we can also consider adding syntactic sugar for this type operator. Instead of doing:
|
||||||
|
```luau
|
||||||
|
type name = index<Person, "name">
|
||||||
|
```
|
||||||
|
We could use:
|
||||||
|
```luau
|
||||||
|
type name = Person["name"]
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```luau
|
||||||
|
type name = Person.name
|
||||||
|
```
|
||||||
|
or even both!
|
Loading…
Add table
Reference in a new issue