luau
luau copied to clipboard
[New Solver] It does not register keys added to an intersection type
-- Not showing all the variables
type playerFrame={Cardspace:cardspace --[[<Only this matters here]],Uno:ImageLabel&{TextLabel:TextLabel},CardAmount:TextLabel,DisplayName:TextLabel,DrawAmount:TextLabel,Elim:TextLabel,Time:TextLabel,read GetChildren:(Instance)->{Instance},Name:string,ClassName:"Frame",Position:UDim2}
type cardspace=Frame&{Turn:BoolValue,Parent:playerFrame}
-- Multiple lines
(playspace:FindFirstChild(plr.DisplayName)::playerFrame).Cardspace.Turn.Value=true
-- Type 'Frame & { Parent: playerFrame, Turn: BoolValue }' does not have key 'Turn'
Can you actually explain in English the behavior you expect to see and the behavior you're actually seeing here?
playerFrame.Cardspace is of type cardspace, which has a key called Turn. But the type engine thinks that there is no such key as Turn.
In order for cardspace to have a key Turn, Frame would have to have a key Turn. An intersection type contains all (and only) the common bits between its component types.
So I can't create an intersection type that would reflect an instance of a specific class and its children?