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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Type inference support for wrapper emitted method #2598

Open
egorbabintcev opened this issue Jan 15, 2025 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@egorbabintcev
Copy link

Is your feature request related to a problem? Please describe.

Is there a reason why the signature of the emitted method in the wrapper class is limited to primitive types and does not infer possible event names and types of their arguments using it's generic class type argument.

Indeed, in typescript projects, it is much more convenient to have autocompletion for possible events that are declared by a component.

Describe the solution you'd like

Infer possible event names (and types of their arguments) if the component declares the appropriate type annotations.

Describe alternatives you've considered

As a temporary alternative, I created a wrapper over the mount function, which redefines the signature of the emitted function in the returned object using typecast (while its runtime implementation remains the same). I calculate the types based on the signature of the $emit method using the generic Parameters helper.

Additional context

-

@cexbrayat
Copy link
Member

Hi @egorbabintcev

I think that would be a welcome improvement 👍 Feel free to open a PR and we will gladly review and merge it!

@cexbrayat cexbrayat added the enhancement New feature or request label Jan 15, 2025
@egorbabintcev
Copy link
Author

@cexbrayat Thanks for the reply. I'll try to do it soon.

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

No branches or pull requests

2 participants