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

fix: compatibility with types/react 18.2.22 #75

Closed
wants to merge 4 commits into from
Closed

Conversation

itsjavi
Copy link
Owner

@itsjavi itsjavi commented Sep 24, 2023

  • chore(deps): update to latest versions
  • refactor: make types more compatible with React
  • chore: remove leftover dep

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.

@codecov
Copy link

codecov bot commented Sep 24, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.01% 🎉

Comparison is base (88c5bd1) 2.73% compared to head (1191f06) 2.75%.

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              
Files Changed Coverage Δ
packages/storylite/src/services/renderer/react.tsx 0.00% <0.00%> (ø)
packages/storylite/src/types/components.ts 0.00% <0.00%> (ø)
packages/storylite/src/types/config.ts 0.00% <0.00%> (ø)
packages/storylite/src/types/parameters.ts 0.00% <0.00%> (ø)
packages/storylite/src/types/story.ts 0.00% <0.00%> (ø)
packages/storylite/src/types/ui.ts 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@itsjavi itsjavi added update-deps Github Actions PR to automatically update dependencies improvement Enhancements and/or refactorings of existing features labels Sep 24, 2023
// globals: Story<P>['globals']
parameters: Story<P>['parameters']
story: BaseStory<F> & { id: string; component: F }
args: Story<F>['args']
Copy link
Collaborator

@jrson83 jrson83 Sep 24, 2023

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) {}

@itsjavi
Copy link
Owner Author

itsjavi commented Sep 27, 2023

fixed in main

@itsjavi itsjavi closed this Sep 27, 2023
@itsjavi itsjavi deleted the refactor-types branch September 27, 2023 20:23
@jrson83
Copy link
Collaborator

jrson83 commented Sep 28, 2023

@itsjavi I tested the main branch again, so far no type errors and forwardRef is working great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Enhancements and/or refactorings of existing features update-deps Github Actions PR to automatically update dependencies
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants