When writing Roact components, I always make sure to use t to validate my props. The problem I run in to is I constantly find myself defining validation for Size, Position, AnchorPoint, and LayoutOrder.
For example, I’m currently writing the entry for a message in a list chat:
local ListChatEntry = Roact.Component:extend("ListChatEntry")
ListChatEntry.validateProps = {
name = t.string,
message = t.string,
nameColor = t.Color3,
LayoutOrder = t.optional(t.number),
Size = t.optional(t.UDim2),
Position = t.optional(t.UDim2),
AnchorPoint = t.optional(t.UDim2),
}
I want this component to be able to have sizing and positional properties applied right on it, so that I don’t have to nest the component in a frame to size and position it.
I always want to have a full list of the props that a component takes, so I think this is unfortunately just a manual process I’ll have to live with. But on the off chance it’s not, is there a way to go about this where I can supply these props without it being so repetitive?