types: Types.object metatable reads typed any; lint baseline 91

This commit is contained in:
4DBug committed 2026-11-01 19:59:50 -06:00
1 parent 6fab0d3dca
commit d339f1e081
2 files changed
+7 -7

No files matched your search

+6 -6
View File
@@ -656,20 +656,20 @@ Types.null = table.freeze(setmetatable({}, nullMeta))
-- own) an entry in a weak map.
local objectMeta: { [any]: { any } } = setmetatable({}, { __mode = "k" }) :: any -- object -> its key order
local function orderOf(v: any): { any }?
local mt = getmetatable(v)
local mt: any = getmetatable(v)
if type(mt) == "table" then
local k = rawget(mt, "__keys")
local k: any = rawget(mt, "__keys")
if k ~= nil then
return k
end
end
return objectMeta[v]
end
local NOKEYS = table.freeze({})
local NOKEYS: { any } = table.freeze({}) :: any
function Types.object(t: { [any]: any }?, keys: { any }?): { [any]: any }
local o: { [any]: any } = t or {}
local k = keys or NOKEYS
local mt = getmetatable(o)
local k: { any } = keys or NOKEYS
local mt: any = getmetatable(o)
if mt == nil or (type(mt) == "table" and rawget(mt, "__keys") ~= nil) then
setmetatable(o, { __object = true, __keys = k })
else
@@ -684,7 +684,7 @@ function Types.set(o: { [any]: any }, k: any, v: any)
local order = orderOf(o)
if order and o[k] == nil and v ~= nil then
if order == NOKEYS then
local mt = getmetatable(o)
local mt: any = getmetatable(o)
if type(mt) == "table" and rawget(mt, "__keys") == NOKEYS then
mt.__keys = { k }
else
+1 -1
View File
@@ -1 +1 @@
92
91