-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typing of reference to other component seems broken #625
Comments
Here's an example repo https://github.com/mvestergaard/emotion625 As far as I can tell, the issue stems from these two overloads: export interface CreateStyled<Props, Theme, IntrinsicProps> {
// overload for template string as styles
(
strings: TemplateStringsArray,
...vars: Array<Interpolation<ThemedProps<Props & IntrinsicProps, Theme>>>
): StyledComponent<Props, Theme, IntrinsicProps>;
// overload for object as styles
(
...styles: Array<
| ObjectStyleAttributes
| ((
props: ThemedProps<Props & IntrinsicProps, Theme>
) => ObjectStyleAttributes)
>
): StyledComponent<Props, Theme, IntrinsicProps>;
} Usually when writing the css as a normal template string, it will use the first overload, but as soon as a reference to another styled component is used, it ends up in the second overload, which causes the error above. @DanielRosenwasser Could you or someone from your team point us in the right direction to fix this? |
Right after writing that comment, I think I may have found the answer. Changing export type InterpolationTypes<Props = {}> =
| InterpolationFn<Props>
| EmotionInterpolation
| StyledComponent<any, any, any>; I'll add a PR |
This fixes an error when referencing another StyledComponent from within a template interpolation string Fixes #625
emotion
version: 9.1.1react
version: 16.3typescript
version: 2.8.1Relevant code.
This results in the following error on
${Child}
:Workaround for now:
The text was updated successfully, but these errors were encountered: