I'm trying to use prop within ifProp, but getting an error that:
[ts]
Argument of type '<Props>(props?: Props) => Props[keyof Props]' is not assignable to parameter of type 'Interpolation<ThemeProps<ThemeInterface>>'.
Type '<Props>(props?: Props) => Props[keyof Props]' is not assignable to type 'InterpolationFunction<ThemeProps<ThemeInterface>>'.
Type 'ThemeInterface' is not assignable to type 'Interpolation<ThemeProps<ThemeInterface>>'.
Type 'ThemeInterface' is not assignable to type 'ReadonlyArray<string | number | false | Styles | Keyframes | StyledComponentClass<any, any, any> | InterpolationFunction<ThemeProps<ThemeInterface>> | ReadonlyArray<FlattenInterpolation<ThemeProps<ThemeInterface>>>>'.
Property 'length' is missing in type 'ThemeInterface'. [2345]
interface SpaceProps {
around?: string;
bottom?: string;
left?: string;
right?: string;
top?: string;
}
export const Space = styled.div<SpaceProps>`
${ifProp(
'around',
css`
margin: ${prop('around')}em;
`
)};
${ifProp(
'top',
css`
margin-top: ${prop('top')}em;
`
)};
${ifProp(
'right',
css`
margin-right: ${prop('right')}em;
`
)};
${ifProp(
'bottom',
css`
margin-bottom: ${prop('bottom')}em;
`
)};
${ifProp(
'left',
css`
margin-left: ${prop('left')}em;
`
)};
`;
I'm assuming I'm doing something wrong, but can't quite pinpoint what the problem may be.
I'm trying to use prop within ifProp, but getting an error that:
I'm assuming I'm doing something wrong, but can't quite pinpoint what the problem may be.