Skip to content

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

Closed

Description

@drwpwrs

Report a bug

When applying the partial keyword to a tuple type such as type(["'foo'", "'bar'"]), the type inferred by TypeScript is Type<["foo"?, "bar"?]>, but this is not reflected by ArkType's internal representation of the type/ validation behavior. It appears the partial keyword does not have a runtime effect on sequences. This is true for types created using both the fluent and string syntaxes.

While the docs say this keyword is for named properties of objects, the type inference implies that tuples are supported. As far as I understand, we want ArkType's partial keyword to behave in the same way as TS's Partial, which is to say we expect:

type(["'foo'"]).partial().equals(type(["'foo'?"]))

🔎 Search Terms

  • partial
  • tuple

🧩 Context

  • ArkType version: 2.1.20
  • TypeScript version: 5.8.3

🧑‍💻 Repro

Playground Link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

  • Status
    Done (merged or closed)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions