-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
fix: compatibility with types/react 18.2.22 #75
Conversation
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #75 +/- ##
========================================
+ Coverage 2.73% 2.75% +0.01%
========================================
Files 45 45
Lines 2811 2796 -15
Branches 58 58
========================================
Hits 77 77
+ Misses 2690 2675 -15
Partials 44 44
☔ View full report in Codecov by Sentry. |
// globals: Story<P>['globals'] | ||
parameters: Story<P>['parameters'] | ||
story: BaseStory<F> & { id: string; component: F } | ||
args: Story<F>['args'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a component has no props at all e.g.:
export default function Form() {}
It throws two type errors:
src/form/form.stories.tsx:16:12 - error TS2322: Type 'unknown' is not assignable to type 'IntrinsicAttributes'.
16 <Story {...context?.args} />
src/form/form.stories.tsx:16:22 - error TS2698: Spread types may only be created from object types.
16 <Story {...context?.args} />
This workaround fixes the issue currently:
export type FormProps = React.ComponentProps<'form'>
export default function Form(_props: FormProps) {}
fixed in main |
@itsjavi I tested the main branch again, so far no type errors and forwardRef is working great! |
This moves us away from framework-agnostic types in the Story definition, but since the project is practically coupled with React, I think it's ok for now, until we focus on providing support for other frameworks.