Nested cyclically referenced type is turned into `any`

type A = {
	B: B;
}
type B = {
	C: C;
}
type C = {
	B: B;
}
local V: A = nil :: any

A is a “container” type which is holding another type “B” which is cyclically referenced by a child type i.e. A.B.C.B == B (in terms of their types). Luau will incorrectly treat A as having the type: A = { B: any }.

image

5 Likes

Thanks for the report! We’ll follow up when we have an update for you.

1 Like

This is especially annoying with modules that require each other! This cyclic behavior makes the type checker angry, and it just gives any or *error-type*, even though the actual code will work. Cyclic types should be allowed!

1 Like