Skip to content
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

Typescript error referencing another selector but it works #45

Open
sekoyo opened this issue Feb 13, 2023 · 0 comments
Open

Typescript error referencing another selector but it works #45

sekoyo opened this issue Feb 13, 2023 · 0 comments

Comments

@sekoyo
Copy link

sekoyo commented Feb 13, 2023

Hi, when referencing another styled component like this:

const Parent = styled('div')``

const Child = styled('div')`
  ${Parent}.active & {
    background: blue;
  }
`

It works but generates the following TS error:

Screenshot 2023-02-13 at 19 22 47

Argument of type 'Component<HTMLAttributes<HTMLDivElement> & AsProps> & { class: (props: HTMLAttributes<HTMLDivElement> & AsProps) => string; }' is not assignable to parameter of type 'string | TagStyleGenerator<HTMLAttributes<HTMLDivElement> & AsProps & ThemeProp>'.
  Type 'Component<HTMLAttributes<HTMLDivElement> & AsProps> & { class: (props: HTMLAttributes<HTMLDivElement> & AsProps) => string; }' is not assignable to type 'TagStyleGenerator<HTMLAttributes<HTMLDivElement> & AsProps & ThemeProp>'.
    Type 'Element' is not assignable to type 'string | number | undefined'.
      Type 'null' is not assignable to type 'string | number | undefined'.ts(2345)

Is this not the correct way, or can this TS error be ignored? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant