ITADN

Add types for render function

#314Pull Requestcheyer 创建于 2024-05-16
C
cheyercommented
Hi there 👋 I've been working with Vue3 / Storybook / Testing Library, and wondered why the props and slots typings work in Storybook. So I took inspiration in Storybook and added typings for the `render` function in vue testing library accordingly. **What has been changed** * added necessary deps * added type for render function component props * added type for render function component slots (`ComponentSlots` by `vue-component-type-helpers` by itself was not sufficient enough, since it does not allow slots of type string (e.g. `slots: { default: 'Test' }`), that's why we need the Typescript magic that Storybook uses) **Reference:** https://github.com/storybookjs/storybook/blob/ba69532715f162567cc17aa3a0de8ca918dfdd2c/code/renderers/vue3/src/public-types.ts#L63-L69
合并状态:未合并 关闭于 2024-05-18 3 条评论