You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using the options knob with {display: multi-select}, it is inferring the return type from the values of the valuesObj, which need to be strings in order for the multi-select to work. The return type is being inferred as string when the multi-select actually returns an array of strings, so string[].
To Reproduce
Steps to reproduce the behavior:
Create a optionsKnob with the display set to multi-select
pass in a values object with the labels and values you expect to see in the dropdown.
pass in a default value, an array of the values you expect to be auto-selected.
check the return value that optionsKnob returns
Expected behavior
Given that the optionsKnob returns an array of strings when it is being used as a multi-select, it should return the correct type information: string[]
Screenshots
The implementation:
The resulting console log of what options is returning:
The type error:
The knob used in the UI is correct:
Code snippets
constvalueOptions={facebook: "facebook",twitter: "twitter",email: "email",link: "link"};constdefaultNetworks: string[]=["facebook","twitter","email","link"];constnetworks: string[]=options(//should return an array of strings"Networks",valueOptions,defaultNetworks,{display: "multi-select"});
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!
Just copied from this very nice detailed explanation in storybookjs/storybook#10692
Until storybookjs/storybook#12561 is resolved, a fix for the type error should be added to v5 🙏
Describe the bug
When using the options knob with
{display: multi-select}
, it is inferring the return type from the values of thevaluesObj
, which need to be strings in order for the multi-select to work. The return type is being inferred asstring
when the multi-select actually returns an array of strings, sostring[]
.To Reproduce
Steps to reproduce the behavior:
optionsKnob
with the display set tomulti-select
optionsKnob
returnsExpected behavior
Given that the
optionsKnob
returns an array of strings when it is being used as a multi-select, it should return the correct type information:string[]
Screenshots
The implementation:
The resulting console log of what
options
is returning:The type error:
The knob used in the UI is correct:
Code snippets
System:
The text was updated successfully, but these errors were encountered: