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

Core: Typing useArgs #17735

Merged
merged 4 commits into from
Jul 2, 2022
Merged

Core: Typing useArgs #17735

merged 4 commits into from
Jul 2, 2022

Conversation

saiichihashimoto
Copy link
Contributor

Issue:
useArgs is great, but it would be nice to type it so it can conform with my component props.

What I did

  • Typed useArgs with a generic, defaulting to the same behavior to be non-breaking.
  • Also, resetArgs was typed with a tuple of [string] rather than being an array as it should be.

@nx-cloud
Copy link

nx-cloud bot commented Mar 16, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 8f8213f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@MichaelArestad MichaelArestad added the maintenance User-facing maintenance tasks label Mar 21, 2022
@shilman shilman changed the title Typing useArgs Core: Typing useArgs Mar 21, 2022
@shilman shilman added the core label Mar 21, 2022
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.

Nice one @saiichihashimoto -- thanks so much!!!

Any chance you can add an example that demonstrates the feature as part of examples/official-storybook? 🙏

@saiichihashimoto
Copy link
Contributor Author

I'm not sure how to go about this @shilman, a little help? There's a lot going on there.

@saiichihashimoto
Copy link
Contributor Author

Not sure if you're able to help me here @shilman, not sure how to go about adding examples tbh.

@ndelangen
Copy link
Member

I updated with an example! Works great, thank you for this @saiichihashimoto !

@shilman I'll merge this as soon as it's green, because this change just makes sense to me.

@ndelangen ndelangen merged commit 013770d into storybookjs:next Jul 2, 2022
@saiichihashimoto saiichihashimoto deleted the type-useArgs-1 branch July 12, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core maintenance User-facing maintenance tasks typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants