Docs: CSF Next - Adjust custom args example for better type safety#33378
Conversation
Updated the documentation to include the proper type for CSF Next, so that the footer becomes a known type to the story
📝 WalkthroughWalkthroughAdds a local TypeScript type alias combining Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/_snippets/page-story-slots.md
🔇 Additional comments (1)
docs/_snippets/page-story-slots.md (1)
276-276: LGTM! Type annotation properly enables TypeScript inference for custom args.The type definition combined with the render function parameter annotation correctly solves the issue. By explicitly typing the destructured props as
PagePropsAndCustomArgs, TypeScript now recognizesfooteras a valid property and can infer the custom arg in CSF Next examples. This mirrors the established pattern from the CSF 3 TypeScript example (line 55).Also applies to: 280-280
|
View your CI Pipeline Execution ↗ for commit 15c1361
☁️ Nx Cloud last updated this comment at |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
jonniebigodes
left a comment
There was a problem hiding this comment.
@matthijsgroen, thanks for taking the time to put together this pull request and helping us improve the documentation by catching this oversight in the examples. We appreciate it.
I've left one small item for you to look into when you have a chance.
Let me know once you've addressed it, and I'll be happy to take another look and merge it.
Hope you have a fantastic day.
stay safe
Added comment and make type multi-line
|
@jonniebigodes done! Thanks for taking your time to review |
|
@matthijsgroen, no need to thank whatsoever, it was my pleasure. Thank you so much for addressing the feedback so promptly. All is good on my end and will merge this once the checklist clears. |
Docs: CSF Next - Adjust custom args example for better type safety (cherry picked from commit 39067a6)
Updated the documentation to include the proper type for CSF Next, so that the footer becomes a known type to the story
Closes #33377
What I did
Added a type definition to the CSF Next example
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Not sure if there is a test already for the documentation of CSF Next, but if there was that test should have been failing. In the example there is no explicit type on the render function, so TS cannot infer the 'footer' type. An explicit type definition is required.
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.