What every container factory accepts: its style, flat, plus its children.
The style properties are the props, and the props object is stored as the
style without a copy: children and name are not style properties, so the
encoder never reads them.
A misspelt property is caught at compile time only in a literal.
TypeScript checks excess properties on a fresh object literal alone, so
Box({ marginLeft: 4 }) is refused while Box({ ...held }) is not; the
factory refuses the unknown key at run time instead. Naming the type where a
spread is unavoidable — const base: ContainerProps = { … } — catches it earlier.
What every container factory accepts: its style, flat, plus its children.
The style properties are the props, and the props object is stored as the style without a copy:
childrenandnameare not style properties, so the encoder never reads them.A misspelt property is caught at compile time only in a literal. TypeScript checks excess properties on a fresh object literal alone, so
Box({ marginLeft: 4 })is refused whileBox({ ...held })is not; the factory refuses the unknown key at run time instead. Naming the type where a spread is unavoidable —const base: ContainerProps = { … }— catches it earlier.