-
-
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: Add ComponentStory convenience type #14780
Conversation
Nx Cloud ReportCI ran the following commands for commit 99ddea0. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
This is a great addition, and it will work as well for components which have inline props like: const Button = ({ label, color }: { label: string, color: string }) => <.../> Adding to that, in the typescript playground that michael shared, you will find both solutions: 1 - Story<typeof Component> (under Example 2) 2 - ComponentStory<typeof Component> (under Example 3) A couple of things to consider:
|
@ndelangen what are your thoughts? :D |
I like it, the only thing I'm unsure about is the addition of a new versioned ts-definition file. I'm not sure that's required considering the definition is an addition anyway? |
@ndelangen happy to remove it -- just did it for consistency (figuring we'd collapse it all at some point anyway) |
Not a blocker @shilman |
@shilman Just thought of another scenario: |
@yannbf Great point. I'll add |
Sounds good! Let's do it |
Issue: N/A
What I did
Added a convenience type,
ComponentStory
for the common case of a story that spreads args directly into a React component.@tooppaaa @gaetanmaisse @ndelangen @tmeasday WDYT?
@yannbf also has some other ideas which are documented here
How to test
CI passes