-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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] Issue with select options
type, does not support array of objects
#9751
Comments
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! |
@shilman do you think this issue will be resolved? |
@jasongerbes it will if somebody from the community picks it up |
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! |
Hey there, it's me again! I am going close this issue to help our maintainers focus on the current development roadmap instead. If the issue mentioned is still a concern, please open a new ticket and mention this old one. Cheers and thanks for using Storybook! |
This is still an issue, can we keep it open? |
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! |
We've just released zero-config typescript support in 6.0-beta. Please upgrade and test it! Thanks for your help and support getting this stable for release! |
Facing the same problem after upgrading to So I first upgraded to module.exports = {
stories: ["../stories/**/*.stories.[tj]s"],
addons: [
"@storybook/addon-knobs/register",
],
typescript: {
check: false,
checkOptions: {}
}
}; And was trying to implement a simple Angular storybook component with So here's the prop data I am passing const countries = [
{ id: 1, countryId: "L", name: "Lithuania" },
{ id: 2, countryId: "U", name: "USA" },
{ id: 3, countryId: "A", name: "Australia" }
]; to be consumed by the knobs with the below line props: {
items: select("items", countries, countries[0], groupId)
} And getting Argument of type '{ id: number; countryId: string; name: string; }[]' is not assignable to parameter of type 'SelectTypeOptionsProp<SelectTypeKnobValue>'.
Type '{ id: number; countryId: string; name: string; }[]' is not assignable to type '(string | number)[]'.
Type '{ id: number; countryId: string; name: string; }' is not assignable to type 'string | number'.
Type '{ id: number; countryId: string; name: string; }' is not assignable to type 'number'.
items: select("items", countries, countries, groupId), Was not sure, if there's some implementation details that I am missing here, so have already raised a StackOverflow question. |
Hi gang, We’ve just released addon-controls in 6.0-beta! Controls are portable, auto-generated knobs that are intended to replace addon-knobs long term. Please upgrade and try them out today. Thanks for your help and support getting this stable for release! |
For anybody who is interested in Controls but don't know where to start, I've created a quick & dirty step-by-step walkthrough to go from a fresh CRA project to a working demo. Check it out: => Storybook Controls w/ CRA & TypeScript There are also some "knobs to controls" migration docs in the Controls README: |
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! |
@shilman I don't think controls currently supports a list of objects as a select type. Whenever I've tried it only displays one option listed as
I could be wrong but I think knobs added support for this earlier in the year, although it could have been only in the 6.0-beta. |
@piemasters controls does not support an array of objects. You can pass it an object whose keys are the labels and whose values are the corresponding data (in any form). Or an array of strings. |
thanks bro |
Bug or support request summary
The
select
knob's type is incorrect, as it does not support using an array of option objects, as per the example in the readme file.Typescript complains with the following error:
Steps to reproduce
Try the above example.
Please specify which version of Storybook and optionally any affected addons that you're running
Affected platforms
The text was updated successfully, but these errors were encountered: