-
Notifications
You must be signed in to change notification settings - Fork 672
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
Inferred type causes confusion #2208
Comments
Hey @samueljseay 👋 Thanks for the issue! I'm probably going to dissapoint you here, but this is by design. What's happening?
What's happening here is that the inferred (just a fancy word for automatic detection) type is If you take a look at the error message, you'll notice
TypeScript doesn't know that your position is of type I explained the solution in the docs https://theme-ui.com/guides/typescript/#union-types-are-not-inferred-without-explicit-annotation Can we change this?If you're okay with Duplicate of #907 |
Hey @herrethan. The problem you described in #2166 (comment) is described in this issue. Would you expect Theme UI to accept any string under |
Hey @hasparus , I knew I read that somewhere! This discussion is also relevant to the TS evolution on the topic. I definitely prefer keeping it as is, typed as I'd rather live with |
Describe the bug
If you declare a style object and don't explicitly type it as
ThemeUICSSObject
then theThemeUIStyleObject
type is inferred andposition: string
is not ok with that type.To Reproduce
Here's a minimal reproduction
Expected behavior
I would expect the inferred type to be ok with
position: string
.Screenshots
n/a
Additional context
n/a
The text was updated successfully, but these errors were encountered: