Closed dwightjack closed 2 years ago
@elevatebart @yannbf any update on this PR? I know you have lots of projects to maintain, so, if you think it might be helpful, I am available to help to maintain this library 😃.
@elevatebart @yannbf any update on this PR? I know you have lots of projects to maintain, so, if you think it might be helpful, I am available to help to maintain this library 😃.
Hey @dwightjack thanks a lot for your contribution! Indeed, there are quite a few other projects hehe and would be super awesome to have a new helping hand! I'll try to check and test your contribution as soon as I can and will let you know!
@elevatebart if you could give a quick check that would be lovely!
Hi, just checking in. Any update on this PR? Is there something blocking it that I missed?
Hey @dwightjack thank you so much for your patience! Things have been quite busy but I'll try my best to get this down and have a release soon!
Hey @dwightjack thanks once again for your patience! I tried making some small changes but I don't have the privileges. I'll merge and make a couple fixes in the following version!
This PR fixes two issues I've encountered trying v0.0.1 with a TypeScript project (and specs written in TS)
Type checking issue
In the spec file I received the following type checking errors:
I am not completely if this is related to a change in the latest Storybook types. Anyway, I reworked the library types to fix the error.
ArgTypes generation.
Looking at the source code I guess that
argTypes
are collected only fromglobalConfig
, but in storybook story files they can also be defined inMeta
and in each individual story.I changed the
argTypes
generation by merging them fromargs
, the story,Meta
, andglobalConfig
.I also noticed that when running the examples on cypress ct, the console logged the following warnings:
So it seems that the
onClick
handler is not defined in the args and as a prop in argTypes.I've updated the library to generate an empty function prop when a prop name either matches the
argTypesRegex
setting or an argType with anaction
property. If the prop is already a function (ie: has been set to a spy in the spec), it won't be changed.