type A = setmetatable<{}, {test: DateTime?}>;
local x: A = setmetatable({}, {
test = nil,
})
even if you set test to DateTime.now(), it still errors:

new type solver
type A = setmetatable<{}, {test: DateTime?}>;
local x: A = setmetatable({}, {
test = nil,
})
even if you set test to DateTime.now(), it still errors:

new type solver
Thanks for the report! The issue here is that bidirectional typing, which is the piece of type inference that pushes expected types (like the A you’ve annotated on x here) into setmetatable’s metatable type. We’ll look into fixing this!
Sorry for the delay in circling back, but a fix for this problem in the latest release and it should be rolling out today. Thanks again for the report!