-
Notifications
You must be signed in to change notification settings - Fork 6
Fix TypeScript Types and argTypes generation #3
Conversation
"@vue/cli-service": "~4.5.0", | ||
"@storybook/testing-vue": "../", |
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.
Had to import directly from the dist
folder because this was causing yarn to re-install over and over the dev dependencies in a loop. Not sure why 🤔 .
@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! |
package.json
Outdated
"@storybook/addons": "^6.2.9", | ||
"@storybook/client-api": "^6.2.9", | ||
"@storybook/vue": "^6.2.9" | ||
"@storybook/addons": "^6.3.7", |
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.
These should actually be moved to peerDeps, and support a bigger range like it's done in the react counterpart:
https://github.com/storybookjs/testing-react/blob/main/package.json#L77
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.
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.