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

CSF: Optionally pass Args generic type from BaseAnnotations to ArgTypes #14356

Merged
merged 1 commit into from
Aug 7, 2021

Conversation

maxmezzomo
Copy link
Contributor

@maxmezzomo maxmezzomo commented Mar 26, 2021

Issue: #14301

What I did

Added the possibility got type Meta's generic Args to be passed to the ArgTypes property for the BaseAnnotation interface.

How to test

I didn't see any ts-expect or similar libraries so automatically test for types. Manually it can be tested.

Notes

The Args generic could be propagated to ArgTypes in more situations, other than just the BaseAnnotations type.
For example in StoryContext:

export declare type StoryContext = StoryIdentifier & {
    ...
    args: Args;
    argTypes: ArgTypes;
    ...
};

These kind of changes however may have required many more changes on related types. And I am not sure how used it would be. Meta seems to be the type most directly used by a user.
The default generic for ArgTypes is therefore set to Record<string, any>

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.

Sorry for the slow response on this @maxmezzomo, this PR got lost in the shuffle and looks great to me. @yannbf WDYT?

@shilman shilman added the csf label Aug 5, 2021
@shilman shilman added this to the 6.4 PRs milestone Aug 5, 2021
@shilman shilman changed the title Optionally pass Args generic from BaseAnnotations to ArgTypes CSF types: Optionally pass Args generic from BaseAnnotations to ArgTypes Aug 7, 2021
@shilman shilman changed the title CSF types: Optionally pass Args generic from BaseAnnotations to ArgTypes CSF: Optionally pass Args generic type from BaseAnnotations to ArgTypes Aug 7, 2021
@shilman shilman merged commit 12ab68c into storybookjs:next Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
args csf maintenance User-facing maintenance tasks typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants