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

Astroturf typescript is not compatible with function components #751

Open
paulcdejean opened this issue Jul 2, 2023 · 0 comments
Open

Comments

@paulcdejean
Copy link

paulcdejean commented Jul 2, 2023

  Type 'ComponentType<any> | keyof IntrinsicElements' is not assignable to type '"length" | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" | "substring" | "toLowerCase" | ... 34 more ... | ComponentType<...>'.
    Type '"symbol"' is not assignable to type '"length" | "toString" | "charAt" | "charCodeAt" | "concat" | "indexOf" | "lastIndexOf" | "localeCompare" | "match" | "replace" | "search" | "slice" | "split" 
| "substring" | "toLowerCase" | ... 34 more ... | ComponentType<...>'.
      Type 'C' is not assignable to type 'FunctionComponent<any>'.
        Type 'ComponentType<any> | keyof IntrinsicElements' is not assignable to type 'FunctionComponent<any>'.
          Type 'string' is not assignable to type 'FunctionComponent<any>'.

89 > extends ForwardRefExoticBase<StyledComponentProps<C, O, A>> {

Code snippet:

import reactLogo from '@/ui/svgs/react.svg'
import viteLogo from '@/ui/svgs/vite.svg'
import styled from 'astroturf/react';

const Logo = styled('img')`
  height: 6em;
  padding: 1.5em;
  will-change: filter;
  transition: filter 300ms;
`;

function Example() {
  const [count, setCount] = React.useState(0)

  return (
    <>
      <div>
        <a href="https://vitejs.dev" target="_blank">
          <Logo src={viteLogo} className="logo" alt="Vite logo" />
        </a>
        <a href="https://react.dev" target="_blank">
          <Logo src={reactLogo} className="logo react" alt="React logo" />
        </a>
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