Open jerelmiller opened 5 years ago
Hey there 👋
I have been unable to use prop with optional keys. I tend to use prop a lot with something like styled-components which gives me a nice shorthand for accessing the interpolated values. Here is an example of a pattern I use quite a bit.
prop
styled-components
interface Props { width?: string } const Button = styled.button<Props>` width: ${prop('width')} ` Button.defaultProps = { width: 'auto' }
I however get an error similar to the following:
Property 'gap' is optional in type ... but required in type 'Record<"gap", string | undefined>
Is this something that is possible? I really like the prop shorthand and tend to use it all over the place. Any help would be appreciated. Thank you!
Stuck with the same issue. Is there any workaround to fix that?
Hey there 👋
I have been unable to use
prop
with optional keys. I tend to useprop
a lot with something likestyled-components
which gives me a nice shorthand for accessing the interpolated values. Here is an example of a pattern I use quite a bit.I however get an error similar to the following:
Is this something that is possible? I really like the
prop
shorthand and tend to use it all over the place. Any help would be appreciated. Thank you!