Maybe the conventions should more closely mirror that of Typescript declaration files...
Your react components have the same semantic objects as BEM almost exactly. We can add prop-types information to wrapped stylesheets by parsing the unique class identifiers. <block>__<element>--<modifier>-<value>
The library could do this when using css modules and blocks (#2). But this would happen at runtime.
It should be possible to add a webpack plugin or babel macro that "type checks" the props passed to Box and Comp.
I haven't fully thought this through, what else needs to be considered?
Maybe the conventions should more closely mirror that of Typescript declaration files...
Your react components have the same semantic objects as BEM almost exactly. We can add prop-types information to wrapped stylesheets by parsing the unique class identifiers.
<block>__<element>--<modifier>-<value>The library could do this when using css modules and blocks (#2). But this would happen at runtime.
It should be possible to add a webpack plugin or babel macro that "type checks" the props passed to
BoxandComp.I haven't fully thought this through, what else needs to be considered?