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

What about more complex types such as email or password? #84

Closed
205g0 opened this issue Sep 10, 2023 · 1 comment
Closed

What about more complex types such as email or password? #84

205g0 opened this issue Sep 10, 2023 · 1 comment

Comments

@205g0
Copy link

205g0 commented Sep 10, 2023

The beauty of telefunc is the auto type validation but I can't express an email or password type well in TS. Both can be checked in the client via HTML Input types but we'd need to check them on the server as well. We could do this manually or employ another val lib like zod but then we'd need to build another infrastructure for the second validation lib, its error handing, etc. Then, why do we have telefunc's auto val in the first place?

And even if we built the second val infrastructure, we'd need to double the zod def or val contract and the RPC function signature/parameters. We could infer from the zod type but would end up with additional boilerplate and/or ruin the simple telefunc api.

I currently use zod, where you have turn-key types for email or can easily set that the password has a min length and so on. TS still lacks and will for some time regex types, check also microsoft/TypeScript#41160 (comment) so I wonder, how telefunc should work IRL without these types.

I really want to use telefunc and hope I miss something...

@brillout
Copy link
Owner

Duplicate of #42.

As for error handling, I don't see any added value compared to the solution suggested at https://telefunc.com/form-validation.

@brillout brillout closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants