qwik
qwik copied to clipboard
DX: Add types for useOn* methods
What is it?
- [x] Feature / enhancement
Description
Allows autocomplete for events when using useOn* methods. Also provides the correct event type for the required QRL. The event name can be a known QwikEvent name or a string. Event type falls back to a plain Event when a string is provided.
Event names are cast to lowercase to prevent breakages.
Updated e2e examples that were typing useOn* methods to Event when a specific event type was available.
Checklist:
- [x] My code follows the developer guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have made corresponding changes to the documentation
- [ ] Added new tests to cover the fix / functionality
Run & review this pull request in StackBlitz Codeflow.
Hi @nnelgxorz
LOVE THIS CHANGES โค๏ธ just tested them and have nothing to complain about it ๐ ๐
The only thing we might should do, is to ๐งน also the docs/tutorial section? here some examples pages which would be invalid after this merge:
- https://qwik.builder.io/tutorial/composing/use/
- https://qwik.builder.io/docs/cheat/best-practices/
- https://qwik.builder.io/tutorial/hooks/use-on/
@manucorporat do you have any objections?
testing results
Hey @zanettin! Sorry for the delay. I update the tutorial pages to remove the unnecessary event casting.
thx a lot @nnelgxorz ๐ ๐
I close this PR because it's stale. Thanks @nnelgxorz for your help, feel free to reopen it.