-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
React: Sound arg types for CSF3 #19238
Conversation
26a8200
to
6f92476
Compare
5f1914d
to
6b2a886
Compare
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.
Awesome! I think we need to make this as non-breaking as possible so that we can postpone figuring out the automigration strategy for now. Will review in more detail next time 🙏
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.
This looks really great. I have a suggestion for one more test.
579cd25
to
0a5f80a
Compare
0a5f80a
to
1cf8658
Compare
@@ -1,4 +1,5 @@ | |||
/* eslint-disable global-require */ | |||
import * as api from '.'; |
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.
can you specify the path e.g. './index'
Issue: #13747
Depends on this CSF pull request:
ComponentDriven/csf#49
What I did
Typesafe args
Changed StoryObj and Meta so that we have increased typesafety for when the user provides args partially in meta.
Considering a Component like this:
It is valid to provide args like this:
While it is invalid too forget an arg, in either meta or the story:
Changed Meta to make sure both a Component, as the Props of the component can be used:
Typesafe decorators/loaders
Decorators now accept a new generic arg argument to be specified:
And the type of meta/story will check if this arg is part of the generic type:
How to test
You can test it by playing with test-d file.