How to correctly type components exported by a library that use define expose using vue interfaces in type module #13264
Unanswered
juanfeie3
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
i made a library that exports some components and when i try to export them, the tools given to type seem a bit odd, i want to know if anyone knows how to properly type a component with its emits, props, slots and expose
i've figured out how to use DefineComponent type and DefineSetupFnCOmponent type reading rundtime-core.d.ts but i can't seem to understand correctly how to type the exposed elements for the IDE to understand them.
I will provide two examples of how im doing it, in both cases i dont feel like its correctly done, the types or interfaces named as Component..... are made by me and contain the info of the component, the others are placeholders or types imported from vue
In the first i use DefineComponent, i can define the props, the emits and the exposed

using this i can export the exposed elements using the RawBindings type but im sure its not how it is supposed to be done, also there are a lot of types being used as placeholders, the slots type is also 3 or 4 generics that im assuming before being able to use it
In this second example i use DefineSetupFnComponent, i can define props, emits and slots but i don't see anywhere to define the exposed, maybe there is no way,

if anyone know how to type the exposed using DefineSetupFnComponent i would be greatly grateful
thanks
Beta Was this translation helpful? Give feedback.
All reactions