Skip to content

fix: partial/required on tuple sequences (#1480) - #1590

Merged
ssalbdivad merged 3 commits into
arktypeio:mainfrom
drwpwrs:fix/1480-partial-tuples
Oct 1, 2026
Merged

ssalbdivad merged 3 commits into
arktypeio:mainfrom
drwpwrs:fix/1480-partial-tuples

Conversation

@drwpwrs

@drwpwrs drwpwrs commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Fixes #1480

partial() and required() had no runtime effect on tuple sequences — only named properties were transformed. Type inference already handled tuples correctly via TS native Partial/Required, but the schema-level sequence was unchanged.

Adds optionalize() and require() methods to SequenceNode that convert between prefix/defaultable/optional element kinds. Defaultables get stripped to plain optionals (partial) or prefix (required). For required() this matches existing behavior where object defaults are stripped. For partial() this is necessary because the sequence model requires defaultables to precede optionals, so prefix elements can't become optional without also converting defaultables.

Sequences with postfix elements bail out since optionals+postfix is invalid in the sequence model.

.t assertion for defaultable tuples skipped due to #1160.

  • Code is up-to-date with the main branch
  • pnpm prChecks passing
  • New unit tests for partial/required on tuples (prefix-only, string syntax, defaultables)

@pullfrog

pullfrog Bot commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Leaping into action...

Pullfrog  | View workflow run | Triggered by Pullfrog | pullfrog.com | 𝕏

# Conflicts:
#	ark/schema/structure/structure.ts
#	ark/type/__tests__/keywords/partial.test.ts
#	ark/type/__tests__/keywords/required.test.ts
@ssalbdivad

Copy link
Copy Markdown
Member

looks like this got fixed in #1653 in the meantime 😅 so I merged main in and just kept your tests since they cover a couple extra cases.

thanks and sorry for the delay!

@ssalbdivad
ssalbdivad merged commit ca8ec6c into arktypeio:main Oct 1, 2026
6 checks passed
@ssalbdivad ssalbdivad mentioned this pull request Oct 1, 2026
4 tasks done
ssalbdivad added a commit that referenced this pull request Oct 1, 2026
Bumps all publishable packages and documents the changes merged since 2.2.6:

- fix `this[]` in self-referential object types (#1618, fixes #1406,
  @yharaskrik)
- parse string.date.epoch.parse input as milliseconds (#1669, @breken-ai)
- keep uppercase UUIDs valid in string.uuid JSON Schema (#1670,
  @breken-ai)
- render nested bigints correctly in error messages (#1626, fixes #1477,
  @chatman-media)
- release unused parse ids from the global registry (#1673, fixes #1584
  for equivalent types, @isaacwasserman)
- fix crashes on Hermes and Turbopack (#1674, fixes #1645 and #1643)

#1590 only adds tests, so it has no changelog entry.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done (merged or closed)

Development

Successfully merging this pull request may close these issues.

runtime check does not match inferred type of tuple with partial keyword applied

2 participants