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
|
```luau
|
||||||
local clock = {}
|
local clock = {}
|
||||||
type Identity = setmetatable<{ time: number }, { __index: clock }>
|
type Identity = setmetatable<{ time: number }, { __index: typeof(clock) }>
|
||||||
```
|
```
|
||||||
|
|
||||||
### `getmetatable` Type Function
|
### `getmetatable` Type Function
|
||||||
|
@ -30,27 +30,27 @@ type Identity = setmetatable<{ time: number }, { __index: clock }>
|
||||||
|
|
||||||
### `setmetatable` Type Function
|
### `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
|
```luau
|
||||||
local animal = {}
|
local animal = {}
|
||||||
type Identity = setmetatable<{
|
type Identity = setmetatable<{
|
||||||
sound: string
|
sound: string
|
||||||
}, {
|
}, {
|
||||||
__index: animal
|
__index: typeof(animal)
|
||||||
}>
|
}>
|
||||||
```
|
```
|
||||||
|
|
||||||
### `getmetatable` Type Function
|
### `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
|
```luau
|
||||||
local animal = {}
|
local animal = {}
|
||||||
type Identity = setmetatable<{
|
type Identity = setmetatable<{
|
||||||
sound: string
|
sound: string
|
||||||
}, {
|
}, {
|
||||||
__index: animal
|
__index: typeof(animal)
|
||||||
}>
|
}>
|
||||||
|
|
||||||
type ReversedIdentity = getmetatable<Identity>
|
type ReversedIdentity = getmetatable<Identity>
|
||||||
|
|
Loading…
Add table
Reference in a new issue