Skip to content

Instantly share code, notes, and snippets.

@jgcmarins
Created March 12, 2019 12:40
Show Gist options
  • Save jgcmarins/0e7a92eea418b509b17fd2e56ad6a23c to your computer and use it in GitHub Desktop.
Save jgcmarins/0e7a92eea418b509b17fd2e56ad6a23c to your computer and use it in GitHub Desktop.
Do not emit warning when using styled-components
// do not emit warning
const StyledIcon = styled(({ isOpen, ...rest }) => <Icon {...rest} />)`
margin-left: ${props => (props.isOpen ? 0 : 1)}px;
font-size: 14px !important;
color: ${props => props.theme.primaryBackgroundColor};
`;
// emit warning
const StyledIcon = styled(Icon)<{ isOpen: boolean }>`
margin-left: ${props => (props.isOpen ? 0 : 1)}px;
font-size: 14px !important;
color: ${props => props.theme.primaryBackgroundColor};
`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment