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

[WIP] Parametrized generic version of TS typing #89

Closed
wants to merge 2 commits into from

Conversation

Andarist
Copy link
Contributor

This is WIP at the moment - but I would love to finish it if this is something you'd like to see merged in.

By accepting a generic parameter (& TS dark magic) we can create mitt instance which has a nice intellisense support and type checking traits - it can know that only certain types can be emitted and that data has certain shape for that particular type. This is demonstrated in typescript/index.ts test.

* doesnt play nicely with this - I mean, it can be types but it's not possible (according to my knowledge to narrow types down in such a way that it would know that type & data are depending on each other. So the only option to type is to accept union of types as type as union of datas as data but this which makes wildcard handler somewhat type-unsafe.

If you would be interested in this I could bring back the previous typings as default (totally unsafe) typing.

@developit
Copy link
Owner

Superseded by #114.

@developit developit closed this Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants