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

Storybook: Update TypeScript types #53748

Merged
merged 3 commits into from
Aug 22, 2023
Merged

Storybook: Update TypeScript types #53748

merged 3 commits into from
Aug 22, 2023

Conversation

mirka
Copy link
Member

@mirka mirka commented Aug 16, 2023

Follow-up to #53520

What?

Updates the deprecated ComponentMeta and ComponentStory types to Meta and StoryFn.

Why?

This resolves all the TypeScript warnings for the deprecated types.

Moving forward, new stories should be written in the CSF3 format using the StoryObj type, but for now the existing CSF2 stories will be kept as is.

Testing Instructions

✅ CI checks pass


cc @bangank36

@mirka mirka added [Type] Code Quality Issues or PRs that relate to code quality Storybook Storybook and its stories for components labels Aug 16, 2023
@mirka mirka requested a review from brookewp August 16, 2023 20:26
@mirka mirka self-assigned this Aug 16, 2023
@mirka mirka requested a review from ajitbohra as a code owner August 16, 2023 20:26
@bangank36
Copy link
Contributor

👍 I'll take this into account on next contributions

@mirka mirka requested a review from chad1008 August 18, 2023 00:52
return <Button { ...props }></Button>;
};

export const Default: Story< typeof Button > = Template.bind( {} );
export const Default = Template.bind( {} );
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why some stories have the type removed (Story< typeof Button > in this case) whereas in others, it is changed from Story to StoryFn, like in ColorIndicator:

export const Default: StoryFn< typeof ColorIndicator > = Template.bind( {} );

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. These explicit typings weren't necessary to begin with, because Template is already typed.

@mirka mirka requested a review from brookewp August 22, 2023 14:09
Copy link
Contributor

@brookewp brookewp left a comment

Choose a reason for hiding this comment

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

Looks good to me! ✅ 🚀

@mirka mirka merged commit f67c386 into trunk Aug 22, 2023
@mirka mirka deleted the storybook/types branch August 22, 2023 17:47
@github-actions github-actions bot added this to the Gutenberg 16.6 milestone Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storybook Storybook and its stories for components [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants