Luau typechecking: Throw out array sibling compatibility when a type is defined

If you have a structure where the value of a map is an array, the array value types are checked against each other rather than whatever type you declare.

type value = {
	{
		x: boolean?,
		y: boolean?
	}
}
local things: {[string]: value} = {
	key = {
		{ x = true },
		{ y = true }
	}
}

{ y = true }Table type '{ y: boolean }' not compatible with type '{ x: boolean }' because the former is missing field 'x'

These sibling types should be tested against the type declared within the value type, rather than being checked against each other.

3 Likes

Thank you for the suggestion.
Making this work seems possible, we are considering it.

1 Like

Fix for this has been implemented, it should arrive in an update next week.

1 Like