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

Addon-knobs: fix knobs function return types #7391

Merged
merged 2 commits into from
Jul 13, 2019

Conversation

emilio-martinez
Copy link
Contributor

Issue: The knobs entry functions (text(...), select(...), etc.) are not retaining the proper return value type, i.e., they're falling back to any instead of string, number, or whatever the appropriate type is for any given knob.

What I did

  • Use a mixture of conditional types and generics to appropriately route the return value types to the main knob functions.
  • Organize the type definitions a bit (It was getting messy. Perhaps a more thorough could take place in a subsequent PR)

How to test

Return values should now come through property for the knob entry functions. Changes should have no runtime impact.

Applies generics and conditional types to ensure a proper return value from each of the knob functions respectively.
@vercel
Copy link

vercel bot commented Jul 11, 2019

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

Latest deployment for this branch: https://monorepo-git-fork-emilio-martinez-fix-addon-knobs-ts-return.storybook.now.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants