Styled-system: TypeScript Error: No overload matches this call

Created on 31 Jul 2020  路  3Comments  路  Source: styled-system/styled-system

Describe the bug
I'm getting this strange error while trying to pass bg prop.

To Reproduce
You can see it on every fresh react/typescript install with styled-components/styled-system

Use codesandbox to create a reproduction:
For quick check :https://codesandbox.io/s/intelligent-hopper-67362?file=/tsconfig.json:0-224

bug

Most helpful comment

@genesis-algorithms

I just spent a long time figuring this out as well! You still have to define your styled component types explicitly even when using the styled-system functions.

interface IProps {
  bg?: string | null;
}
const Button = styled.button<IProps>`
  ${color}
`;

Will fix this!

All 3 comments

@genesis-algorithms

I just spent a long time figuring this out as well! You still have to define your styled component types explicitly even when using the styled-system functions.

interface IProps {
  bg?: string | null;
}
const Button = styled.button<IProps>`
  ${color}
`;

Will fix this!

Does the latest react break the types?

I'm closing this since @chrisMYchen answer was what I was looking for... Thanks, everyone!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kevinSuttle picture kevinSuttle  路  4Comments

gausie picture gausie  路  4Comments

gregberge picture gregberge  路  4Comments

fk picture fk  路  3Comments

releaf picture releaf  路  3Comments