mirror of
https://github.com/luau-lang/rfcs.git
synced 2025-05-04 10:43:48 +01:00
Fix typeof() usage
This commit is contained in:
parent
406fdf2bba
commit
97d436849f
1 changed files with 5 additions and 5 deletions
|
@ -19,7 +19,7 @@ could be reduced to:
|
|||
|
||||
```luau
|
||||
local clock = {}
|
||||
type Identity = setmetatable<{ time: number }, { __index: clock }>
|
||||
type Identity = setmetatable<{ time: number }, { __index: typeof(clock) }>
|
||||
```
|
||||
|
||||
### `getmetatable` Type Function
|
||||
|
@ -30,27 +30,27 @@ type Identity = setmetatable<{ time: number }, { __index: clock }>
|
|||
|
||||
### `setmetatable` Type Function
|
||||
|
||||
In the following code example, `Identity` should evaluate to `{ sound: string, @metatable: { __index: animal } }`:
|
||||
In the following code example, `Identity` should evaluate to `{ sound: string, @metatable: { __index: typeof(animal) } }`:
|
||||
|
||||
```luau
|
||||
local animal = {}
|
||||
type Identity = setmetatable<{
|
||||
sound: string
|
||||
}, {
|
||||
__index: animal
|
||||
__index: typeof(animal)
|
||||
}>
|
||||
```
|
||||
|
||||
### `getmetatable` Type Function
|
||||
|
||||
In the following code example, `ReversedIdentity` should evaluate to `{ __index: animal }`:
|
||||
In the following code example, `ReversedIdentity` should evaluate to `{ __index: typeof(animal) }`:
|
||||
|
||||
```luau
|
||||
local animal = {}
|
||||
type Identity = setmetatable<{
|
||||
sound: string
|
||||
}, {
|
||||
__index: animal
|
||||
__index: typeof(animal)
|
||||
}>
|
||||
|
||||
type ReversedIdentity = getmetatable<Identity>
|
||||
|
|
Loading…
Add table
Reference in a new issue