Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add types for render function #314

Merged
merged 2 commits into from
May 18, 2024

Conversation

cheyer
Copy link
Contributor

@cheyer cheyer commented May 16, 2024

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

Copy link
Member

@afontcu afontcu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you!

@afontcu
Copy link
Member

afontcu commented May 18, 2024

build is failing due to some lint errors, would you mind taking a look?

@cheyer
Copy link
Contributor Author

cheyer commented May 18, 2024

build is failing due to some lint errors, would you mind taking a look?

Thanks for the review! The linting error should be fixed now!

@cheyer cheyer requested a review from afontcu May 18, 2024 08:09
@afontcu afontcu merged commit d46ed8f into testing-library:main May 18, 2024
4 checks passed
Copy link

馃帀 This PR is included in version 8.1.0 馃帀

The release is available on:

Your semantic-release bot 馃摝馃殌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants