Fix typeof() usage

This commit is contained in:
ffrostfall 2025-02-04 00:37:54 -05:00 committed by GitHub
parent 406fdf2bba
commit 97d436849f
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -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>