Skip to content

.partial() is ignoring custom error messages on fields in a typeΒ #1492

Closed

Description

@gregg-cbs

Report a bug

When using .partial() on a type the custom errors of the fields in that type get voided.

πŸ”Ž Search Terms

partial, custom error

🧩 Context

  • ArkType version: 2.1.20

πŸ§‘β€πŸ’» Repro

Playground Link:
https://arktype.io/playground?code=import%20%7B%20type%20%7D%20from%20%22arktype%22%0A%0Aconst%20productBase%20%3D%20type(%7B%0A%09dates%3A%20type(%7B%20start%3A%20%22string%22%2C%20end%3A%20%22string%22%20%7D)%0A%09%09.array()%0A%09%09.atLeastLength(1)%0A%09%09.configure(%7B%20message%3A%20%22Datess%20are%20required%22%20%7D)%0A%7D)%0A%0Aconst%20ticket%20%3D%20type(%7B%0A%09%22...%22%3A%20productBase%2C%0A%09type%3A%20%22'ticket'%22%0A%7D)%0A%0Aconst%20merchandise%20%3D%20type(%7B%0A%09%22...%22%3A%20productBase%2C%0A%09type%3A%20%22'merchandise'%22%0A%7D)%0A%0Aconst%20Thing%20%3D%20type(ticket%2C%20%22%7C%22%2C%20merchandise)%0A%0A%2F%2F%20Throws%20correct%20error%3A%20%22Datess%20are%20required%22%0Aconst%20out%20%3D%20Thing.from(%7B%0A%09type%3A%20%22ticket%22%2C%0A%09dates%3A%20%5B%5D%0A%7D)%0A%0A%2F%2F%20Throws%20incorrect%20error%20because%20of%20the%20partial()%3A%20%22dates_redeemable%20must%20be%20exactly%20length%201%20(was%200)%22%0Alet%20otherOut%20%3D%20Thing.partial().from(%7B%0A%09type%3A%20%22ticket%22%2C%0A%09dates%3A%20%5B%5D%0A%7D)%0A

import { type } from "arktype"

const productBase = type({
	dates: type({ start: "string", end: "string" })
		.array()
		.atLeastLength(1)
		.configure({ message: "Datess are required" })
})

const ticket = type({
	"...": productBase,
	type: "'ticket'"
})

const merchandise = type({
	"...": productBase,
	type: "'merchandise'"
})

const Thing = type(ticket, "|", merchandise)

// Throws correct error: "Datess are required"
const out = Thing.from({
	type: "ticket",
	dates: []
})

// Throws incorrect error because of the partial(): "dates_redeemable must be exactly length 1 (was 0)"
let otherOut = Thing.partial().from({
	type: "ticket",
	dates: []
})

Activity

  1. added
    bug
    on Aug 19, 2025
  2. ssalbdivad commented on Nov 18, 2026

    @ssalbdivad
    Member

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

  3. moved this from To do 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

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