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

Add v.tuple([...]) #2

Merged
merged 1 commit into from
Mar 25, 2021
Merged

Add v.tuple([...]) #2

merged 1 commit into from
Mar 25, 2021

Conversation

reinismu
Copy link
Contributor

@reinismu reinismu commented Mar 25, 2021

Tried to be a good user and contribute.

This is the last feature I need to migrate from slow zod to valita.

Will solve #1

@jviide
Copy link
Contributor

jviide commented Mar 25, 2021

Wow, thank you! I've been mulling over implementing the tuple type in my head, so it's great that you took the lead on this.

I'll merge this pull request and might add some ideas to the overall implementation (maybe combining array/tuple implementations similarly to record/object) before publishing v0.0.10. I'll ping you here when I publish 👍

@jviide jviide merged commit 47b3bbd into badrap:main Mar 25, 2021
@jviide
Copy link
Contributor

jviide commented Mar 26, 2021

@reinismu v0.0.10 (and v0.0.11 as I forgot to add the message for the new invalid_length error) has now been published to NPM. Big thanks once again 🙂

I ended up combining the array and tuple implementations. Maybe one day we can have tuple types like [A, B, ...C[]]! Also, invalid_type errors from tuple parsers give the expected (input) type as array, as that's the "fundamental" JavaScript type behind both tuples and arrays (and v.union(...) uses that type to optimize its matching paths).

@jviide jviide mentioned this pull request Mar 26, 2021
@reinismu
Copy link
Contributor Author

@jviide Awesome :) Time to implement it in my project

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

Successfully merging this pull request may close these issues.

2 participants