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

Typescript: Fix bug with meta not working well as generic parameter for StoryObj #20165

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

kasperpeulen
Copy link
Contributor

@kasperpeulen kasperpeulen commented Dec 8, 2022

There is a bug when meta is specifically typed as an object with only optional keys:

const meta: Meta<{optional?: 'key'}> = { // }

type Story = StoryObj<typeof meta>; 

The story args will be inferred as Record<string, any>

What I did

  • Upgraded to latest CSF which fixes the bug
  • Fixed some type issues in ui/blocks that are uncovered by the fix I guess :)

How to test

Run yarn task --task check

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except pls upgrade CSF next before merging

@@ -78,7 +78,7 @@
"dependencies": {
"@storybook/client-logger": "7.0.0-beta.0",
"@storybook/core-events": "7.0.0-beta.0",
"@storybook/csf": "next",
"@storybook/csf": "0.0.2--canary.60.011a95e.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👎

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change back to next yes

@kasperpeulen kasperpeulen force-pushed the kasper/sb-1071-fix-ts-bug-with-meta-not-accepted branch from 113cfc9 to 0fbefa5 Compare December 12, 2022 09:52
@kasperpeulen kasperpeulen force-pushed the kasper/sb-1071-fix-ts-bug-with-meta-not-accepted branch from 0fbefa5 to 3f6cf96 Compare December 12, 2022 10:08
@kasperpeulen kasperpeulen merged commit df84a9f into next Dec 12, 2022
@kasperpeulen kasperpeulen deleted the kasper/sb-1071-fix-ts-bug-with-meta-not-accepted branch December 12, 2022 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants