-
Notifications
You must be signed in to change notification settings - Fork 257
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
feat: getComponent #89
Conversation
This introduces a `getComponent` which returns a `VueWrapper` or throws. It offers two benefits: - a symetric API for components/elements with `findComponent/findAllComponents/getComponent`/`find/findAll/get` - a better experience for TS users (as `findComponent` returns a union type, you can't chain certain things until you disambiguated the type manually). I also refactored the signatures of `find` to offer proper overloads (the current version breaks tests compilation in a real app, i hope this fixes it). I added TSD tests to ensure the inference is working properly.
I had this exact thought the other day - I think this makes sense. We have I see you didn't include I will wait for at least one more approval on this PR, to let others have input as well 👍 An aside: testing types is a very cool concept I just learned about recently. |
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.
Looks good overall, other than the small details I suggested 👍
@lmiller1990 👍 Thank you for the quick review. @afontcu I pushed a new commit with your suggestion for |
Nice, I will do a new alpha this weekend. |
This introduces a
getComponent
which returns aVueWrapper
or throws.It offers two benefits:
findComponent/findAllComponents/getComponent
/find/findAll/get
findComponent
returns a union type, you can't chain certain things until you disambiguated the type manually).I also refactored the signatures of
find
to offer proper overloads (the current version breaks tests compilation in a real app, i hope this fixes it). I added TSD tests to ensure the inference is working properly.