Skip to content

Improve sequence min/max length expressions/descriptions #1430

Closed

Description

@ssalbdivad

Currently, min/maxLength aren't included in sequence expressions. These tests should be added and pass without breaking existing tests by adding redundant descriptions like [number] == 1:

it("minLength expression", () => {
  const T = type("number[] > 1");
  attest(T.expression).snap("number[] >= 2");
});

it("minLength description", () => {
  const T = type("number[] > 1");
  attest(T.description).snap("number[] at least length 2");
});

it("maxLength expression", () => {
  const T = type("number[] < 5");
  attest(T.expression).snap("number[] <= 4");
});

it("maxLength description", () => {
  const T = type("number[] < 5");
  attest(T.description).snap("number[] at most length 4");
});

it("both bounds expression", () => {
  const T = type("0 < number[] <= 5");
  attest(T.expression).snap("1 < number[] <= 5");
});

it("both bounds description", () => {
  const T = type("0< number[] <= 5");
  attest(T.description).snap("number[] at most length 5 and non-empty");
});

Activity

  1. moved this from To do to Backlog in arktypeioon Apr 18, 2025
  2. added 4 commits that reference this issue on Oct 13, 2026
    8c66cc7
    3694472
    6129568
    ecafabd
  3. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    MemberAuthor

    Fixed in 3.0.0-beta.0 (#1728). Try it with npm i arktype@next.

  4. moved this from Backlog to Done (merged or closed) in arktypeioon Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Done (merged or closed)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions