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

chore(Arktype): Upgrade arktype to 2.0 #15

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

jhechtf
Copy link
Owner

@jhechtf jhechtf commented Feb 7, 2025

TL;DR

Updated arktype dependency to v2.0.4 and refactored validation logic to handle the new error handling approach.

What changed?

  • Upgraded arktype from v1.0.28-alpha to v2.0.4
  • Enhanced formDataToObject to handle specified array indices and object keys
  • Updated validation logic to use arktype's new error handling system
  • Added new test cases for array and object handling in FormData
  • Added eslint rule to limit static destructure depth

How to test?

  1. Run the test suite with pnpm test
  2. Test FormData validation with arrays using specified indices:
const fd = new FormData();
fd.append('names[0]', 'bob');
fd.append('names[2]', 'joe');
fd.append('names[1]', 'rob');
  1. Test FormData validation with object keys:
const fd = new FormData();
fd.append('locations[london]', '24');
fd.append('locations[new_york]', '77');

Why make this change?

The update to arktype v2.0.4 provides improved type validation and error handling. The enhanced FormData handling allows for more flexible data structures when working with form submissions, supporting both indexed arrays and object key-value pairs.

Copy link
Owner Author

jhechtf commented Feb 7, 2025

Copy link

changeset-bot bot commented Feb 7, 2025

🦋 Changeset detected

Latest commit: e3b452e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@jhecht/arktype-utils Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jhechtf jhechtf marked this pull request as ready for review February 7, 2025 23:54
@jhechtf jhechtf force-pushed the feat/upgrade-arktype-utils-to-v2 branch 7 times, most recently from 94735d6 to 280f7d5 Compare February 8, 2025 05:40
Copy link
Owner Author

jhechtf commented Feb 8, 2025

Merge activity

  • Feb 8, 1:04 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Feb 8, 1:05 AM EST: Graphite rebased this pull request as part of a merge.
  • Feb 8, 1:07 AM EST: A user merged this pull request with Graphite.

@jhechtf jhechtf changed the base branch from feat/update-formdata-for-nested-objects to graphite-base/15 February 8, 2025 06:04
@jhechtf jhechtf changed the base branch from graphite-base/15 to main February 8, 2025 06:04
@jhechtf jhechtf force-pushed the feat/upgrade-arktype-utils-to-v2 branch from 280f7d5 to e3b452e Compare February 8, 2025 06:05
@jhechtf jhechtf merged commit c2196c0 into main Feb 8, 2025
4 checks passed
@jhechtf jhechtf deleted the feat/upgrade-arktype-utils-to-v2 branch February 8, 2025 06:07
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.

1 participant