Skip to content

Strip optional/default type-level attributes on .required() #1160

Closed

Description

@ssalbdivad

This would fix the following case:

// https://github.com/arktypeio/arktype/issues/1156
it("with default", () => {
  const t = type({ foo: "string = 'bar'" }).required();

  const expected = type({
    foo: "string",
  });

  // currently the types do not match because the default is not removed
  attest<typeof expected.t, typeof t.t>();

  attest(t.expression).equals(expected.expression);
});

Should also add cases for optionality on the value

Activity

  1. added 3 commits that reference this issue on Oct 13, 2026
    a55e764
    0ef47b2
    b8f064f
  2. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    MemberAuthor

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

  3. 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