New type solver can no longer cast to more generic type when strict mode is enabled

Code such as the following provides a typechecking error when the new type solver is enabled:

--!strict

local function foo(_: {[string]: boolean})
	-- Nothing even needs to go in here; just need a function to show off this bug
end

local qux: {baz: boolean} = {baz = false}

foo(qux) --Type '{ baz: boolean }' could not be converted into '{ [string]: boolean }'

This does not produce a typechecking error when the new type solver is disabled.

Expected behavior

I expect to be able to use a more strict type definition in a function which accepts a more generic type as long as both types are compatible; this was not an issue in my scripts which used this functionality previously.

2 Likes