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 select options types to allow string[] and null #7356
Addon-knobs: Fix select options types to allow string[] and null #7356
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-fork-emilio-martinez-fix-7348-addon-knobs-select.storybook.now.sh |
@@ -3,17 +3,15 @@ import PropTypes from 'prop-types'; | |||
|
|||
import { Form } from '@storybook/components'; | |||
|
|||
type SelectTypeKnobValue = string; | |||
export type SelectTypeKnobValue = string | string[] | null; |
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.
Are select()
knobs always strings? Is select(1, 2, 3, 4)
not possible?
Also, if you allow nulll.. is the intention to pass in a null value as knob, like that select(null, 'string')
?
If yes, this could be useful too: select(null, undefined, 'string')
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.
Good points! You're right, technically numbers should be fine because they'd pass the strict eq. comparison. I had added null
because it was in the example, and similarly undefined
should work.
Updated. Let me know your thoughts!
4ea6034
to
5620db2
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.
LGTM
Issue: #7348
What I did
Fixed
select(...)
knob types to allow for:string
,string[]
andnull
.string[]
in addition to objects.This better aligns with the Knobs Addons select docs, i.e.: