-
Notifications
You must be signed in to change notification settings - Fork 22
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
TS error when using prop with ThemedStyledComponentsModule #53
Comments
Curious if anyone has had this problem. I still haven't figured this out, yet. |
Sorry @DevanB. I missed this issue. The code you pasted seems right. I've never seen that error with styled-tools. If you can provide a small reproduction repository, I can investigate it further. |
I've been trying to reproduce it in CodeSandbox, but haven't had much luck yet. The problem only occurs when I update to styled-components v4, for some reason. I'll keep trying to reproduce. UPDATE: The issue is no longer an issue if I remove the UPDATE AGAIN: I was able to fix it completely by doing this:
|
@diegohaz Okay, so the above works, but I think I've found a logical error. When I use the component like
When I expect it to be:
is evaluating to Is there a way to treat |
You can pass a function: ifProp(props => props.right !== undefined, true, false); By the way, only in your last update you put this line: import { css, styled } from '../theme'; I guess the typing problem with |
I gathered something in our
|
If you import From what I see, you're doing it right, so probably it's a styled-tools issue. I have no idea how to fix this though. Ah, not directly related to the issue, but I think you don't need to define the theme shape twice ( export const theme = {
...
};
export type ThemeInterface = typeof theme; |
The good news is that it is working for us (thanks for your consistent and continual help!). I'll keep an eye on it and see what could possibly be the issue. Would you want to leave this open as an issue, or should I submit an issue with more specific details and close this issue? |
I think we should keep this open. I'll update the title to better reflect the problem. |
Think I found another instance of something not agreeing with TypeScript and/or ThemeStyledComponentsModule:
In here, it seems the types of styled-tools and possibly of styled-components aren't aligned. I'll keep looking. |
If you go to |
I'm trying to use prop within ifProp, but getting an error that:
I'm assuming I'm doing something wrong, but can't quite pinpoint what the problem may be.
The text was updated successfully, but these errors were encountered: