Unknown type 'setmetatable' type error. Why?

--!strict

type Map = {
	Name : string;
	Icon : string;
}
type MapSlot = {
	__index : MapSlot;
	new : (Map) -> setmetatable<{}, {__index : typeof(MapSlot)}>;
}

local mapSlot = {} :: MapSlot
mapSlot.__index = mapSlot

function mapSlot.new(map : Map)
	return setmetatable({}, mapSlot)
end

Warning occurs on line 9:
image
What am I doing wrong?

Using the same code, I don’t have the warning pop up (instead, it highlights MapSlot as an unknown).
Just to check - if you go to File → Beta Features, then look for New Luau Type Solver, is it enabled? If not, can you please try enabling it?

1 Like

Someone turned off Workspace.UseNewLuauTypeSolver in the team create place…

Anyway, thanks for bringing the new type solver to my attention. I didn’t realize setmetatable<> doesn’t work with the older type solver.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.