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

Typescript Errors #223

Open
robodna opened this issue Jul 9, 2024 · 6 comments
Open

Typescript Errors #223

robodna opened this issue Jul 9, 2024 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@robodna
Copy link

robodna commented Jul 9, 2024

I see a typescript warning on 'field' and 'props' for the following:

<Field name="owner" validate={required('Please enter your name.')}> {(field, props) => (

I tried setting to the following but still get an error:

field:FieldStore, props:FieldElementProps

What am I doing wrong?

Thanks

@fabian-hiller
Copy link
Owner

Does required<string>('Please enter your name.') fix it?

@fabian-hiller fabian-hiller self-assigned this Jul 10, 2024
@fabian-hiller fabian-hiller added the question Further information is requested label Jul 10, 2024
@robodna
Copy link
Author

robodna commented Jul 10, 2024

It is the <Field>'s child function that throws Typscript warnings:

field:FieldStore, props:FieldElementProps

@fabian-hiller
Copy link
Owner

I need more of your code or a reproduction on Stackblitz. What framework are you using?

@robodna
Copy link
Author

robodna commented Jul 11, 2024

I"m using SolidJS. Typescript does not like FieldStore or FieldElementProps as types. The both have an underline in red in VisualStudioCode. I just set them both to :any to hide the warnings.

@fabian-hiller
Copy link
Owner

Feel free to create a reproduction using this template: https://stackblitz.com/edit/modular-forms-solid?file=src/routes/login.tsx

@robodna
Copy link
Author

robodna commented Jul 13, 2024

I'll have to investigate further since some components do not show the Typescript warning, but some do. It may have to do with the <Form element being in a separate component instead of in the same component as the <Field elements. I have a component to render the start of the <Form, and then another component which renders the <Field components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants