fabian-hiller / modular-forms

The modular and type-safe form library for SolidJS, Qwik and Preact
https://modularforms.dev
MIT License
1.05k stars 55 forks source link

Qwik: Latest qwik release breaks types #168

Open genox opened 10 months ago

genox commented 10 months ago

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.

fabian-hiller commented 10 months ago

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

juanpmarin commented 10 months ago

Wating for this upgrade too :)

fabian-hiller commented 10 months ago

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

juanpmarin commented 10 months ago

@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?

fabian-hiller commented 10 months ago

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

brandonpittman commented 10 months ago

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.

fabian-hiller commented 10 months ago

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

fabian-hiller commented 10 months ago

v0.23.0 is available

juanpmarin commented 10 months ago

@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>'.
fabian-hiller commented 10 months ago

Please try to remove QRL:

ref?: (element: Element) => void;
juanpmarin commented 10 months ago

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.
fabian-hiller commented 10 months ago

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

fabian-hiller commented 10 months ago

v0.23.1 is available

juanpmarin commented 10 months ago

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