modular-forms icon indicating copy to clipboard operation
modular-forms copied to clipboard

Qwik: Latest qwik release breaks types

Open genox opened this issue 1 year ago • 14 comments

Just upgraded to qwik 1.3.3 and it seems some types have been changed. A text input field component I based on https://modularforms.dev/qwik/guides/input-components throws TS errors for all defined FunctionProps.

genox avatar Jan 10 '24 22:01 genox

Thank you for the hint! I will update the guide.

fabian-hiller avatar Jan 11 '24 15:01 fabian-hiller

Wating for this upgrade too :)

juanmarin-co avatar Jan 14 '24 01:01 juanmarin-co

Will update the guide and check the code next week. Its on my list.

fabian-hiller avatar Jan 14 '24 03:01 fabian-hiller

@fabian-hiller do you have to make changes in the library or can it be fixed just by changing the way the library is invoked?

juanmarin-co avatar Jan 18 '24 18:01 juanmarin-co

I need to look into this. Some people have reported runtime errors with the new Qwik version.

fabian-hiller avatar Jan 18 '24 18:01 fabian-hiller

I need to look into this. Some people have reported runtime errors with the new Qwik version.

Using this at work—no runtime errors, just type errors when building the app.

brandonpittman avatar Jan 19 '24 02:01 brandonpittman

I think I have fixed everything. I will release a new version soon.

fabian-hiller avatar Jan 19 '24 17:01 fabian-hiller

v0.23.0 is available

fabian-hiller avatar Jan 19 '24 18:01 fabian-hiller

@fabian-hiller I'm declaring ref like this for one of my components:

ref?: QRL<(element: Element) => void>;

Because I need to explicitly call ref from an useTask$ context, but types are not compatible:

Types of property 'ref' are incompatible.
      Type '(element: Element) => void' is not assignable to type 'QRL<(element: Element) => void>'.

juanmarin-co avatar Jan 19 '24 20:01 juanmarin-co

Please try to remove QRL:

ref?: (element: Element) => void;

fabian-hiller avatar Jan 19 '24 20:01 fabian-hiller

If I remove QRL, the type error gets fixed in the Field, but breaks in the useTask$

When referencing "props" inside a different scope (useTask$), Qwik needs to serialize the value, however "props.ref" is a function, which is not serializable.

juanmarin-co avatar Jan 19 '24 20:01 juanmarin-co

Ok. I will try to change the types to QRL<…>.

fabian-hiller avatar Jan 19 '24 20:01 fabian-hiller

v0.23.1 is available

fabian-hiller avatar Jan 19 '24 20:01 fabian-hiller

@fabian-hiller everything compiles in my project now, thanks a lot!

juanmarin-co avatar Jan 19 '24 22:01 juanmarin-co