qwik icon indicating copy to clipboard operation
qwik copied to clipboard

DX: Add types for useOn* methods

Open nnelgxorz opened this issue 2 years ago โ€ข 1 comments

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

nnelgxorz avatar Jan 15 '23 01:01 nnelgxorz

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

stackblitz[bot] avatar Jan 15 '23 01:01 stackblitz[bot]

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

Bildschirmfoto 2023-02-22 um 22 52 05 Bildschirmfoto 2023-02-22 um 22 52 37 Bildschirmfoto 2023-02-22 um 22 53 02 Bildschirmfoto 2023-02-22 um 22 56 04

zanettin avatar Feb 22 '23 22:02 zanettin

Hey @zanettin! Sorry for the delay. I update the tutorial pages to remove the unnecessary event casting.

nnelgxorz avatar Mar 06 '23 21:03 nnelgxorz

thx a lot @nnelgxorz ๐ŸŽ‰ ๐Ÿ™

zanettin avatar Mar 06 '23 21:03 zanettin

I close this PR because it's stale. Thanks @nnelgxorz for your help, feel free to reopen it.

gioboa avatar Oct 10 '23 20:10 gioboa