KraXen72
better way to type props with default props
this is what i've come up with so far. is there a simpler/better way to type it?
- the props should be optional, since i'm defining defaults for it
- it should include optional children, since that's a special prop
- i don't want a separate prop type for each component.
- it should account for the fact that there can be additional props (thus the record string extension) - is this not a good idea? let me know!
this works but, maybe i'm missing some obvious way to do it better.
if this is really the general way it should be typed (like solid does not have some helper types for the pretty common scenario of default props), atleast i'd like to get rid of the
typeof
if possible, and move that to the helper type.10 replies