Skip to content

fix: preserve integer enum and const values in type errors - #288

Merged
jdesrosiers merged 2 commits into
hyperjump-io:mainfrom
Kaileshwar16:fix/integer-enum-const-errors
Oct 12, 2026
Merged

jdesrosiers merged 2 commits into
hyperjump-io:mainfrom
Kaileshwar16:fix/integer-enum-const-errors

Conversation

@Kaileshwar16

@Kaileshwar16 Kaileshwar16 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #287

Schemas combining type: "integer" with integer enum or const values incorrectly reported
“A value is not allowed here” when validation failed. For example, enum: [1, 2] now
correctly reports “Expected one of 1 or 2”.

Use a shared type-compatibility predicate for enum and const filtering, checking
serialized numeric values with Number.isInteger. Preserve existing number/string
behavior, message formatting, and schema-location attribution.

Add 14 regression fixtures covering integers, fractions, union types, negative values,
zero, exponential notation, incompatible types, successful validation, and nested
locations through both public API paths.

Validation:

  • Before fix: 29 focused failures.
  • After fix: 67 focused tests passed.
  • Full suite: 1,313 tests passed.
  • Lint and type check passed.

Environment note: Vitest warned that Node 25 is outside its supported engine range; all
checks completed successfully.

@jdesrosiers
jdesrosiers merged commit 2aa683c into hyperjump-io:main Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integer enum and const values are filtered out when generating type errors

2 participants