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

[BUG] - Can't pass custom variants props to styled component #462

Closed
notmedia opened this issue May 9, 2022 · 2 comments
Closed

[BUG] - Can't pass custom variants props to styled component #462

notmedia opened this issue May 9, 2022 · 2 comments
Labels
🐛 Type: Bug Something isn't working

Comments

@notmedia
Copy link

notmedia commented May 9, 2022

Describe the bug

import { styled } from '@nextui-org/react';
import React from 'react';

const StyledDiv = styled('div', {
  variants: {
    custom: {
      true: {},
      false: {},
    },
  },
});

interface CustomDivProps {
  custom?: boolean;
}

export const CustomDiv: React.FC<CustomDivProps> = ({ custom = false }) => (
  <StyledDiv custom={custom} /> // Getting TS error `No overload matches this call.`
);

If I use import { styled } from '@stitches/react' then it works and the StyledDiv has custom property

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

In desctipion

Expected behavior

I expect that styled from NextUI add custom variants props

Screenshots or Videos

No response

Operating System Version

macos

Browser

Chrome

@notmedia notmedia added the 🐛 Type: Bug Something isn't working label May 9, 2022
@notmedia
Copy link
Author

notmedia commented May 9, 2022

After research found the solution. The problem was with TS version, this problem occures on typescript 4.6.4. After downgrading to 4.5.5 it works fine.

So in the future this would be perfect if we support the latest ts

@notmedia
Copy link
Author

notmedia commented May 9, 2022

Will be fixed in #434

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants