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

typecasts break cross file selectors #162

Open
jantimon opened this issue Sep 26, 2024 · 0 comments
Open

typecasts break cross file selectors #162

jantimon opened this issue Sep 26, 2024 · 0 comments
Labels
bug Something isn't working types Typescript types related

Comments

@jantimon
Copy link
Owner

it looks like typesrcript type casts (as) confuse our ast visitor and therefore break cross file selectors:

import { StyledSvg1 } from "./works";
import { StyledSvg1 } from "./broken";

export const Foo = styled.button`
  ${StyledSvg1} { color: red } 
  ${StyledSvg2} { color: red } 
`

works.tsx

export const StyledSvg1 = styled.svg``;

broken.tsx

import { type DefaultTheme, type StyledComponent } from "styled-components";
export const StyledSvg2 = styled.svg``as unknown as StyledComponent<
  "svg",
  DefaultTheme,
  {}
> & {
  __yak: true;
};
@jantimon jantimon added bug Something isn't working types Typescript types related labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working types Typescript types related
Projects
None yet
Development

No branches or pull requests

1 participant