Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(types): align ValidationErrorItem typings with runtime (v6 backport)#18159

Open
abdelrahmanSheref101 wants to merge 2 commits into
sequelize:v6sequelize/sequelize:v6from
abdelrahmanSheref101:fix/v6-typings-validation-errorabdelrahmanSheref101/sequelize:fix/v6-typings-validation-errorCopy head branch name to clipboard
Open

fix(types): align ValidationErrorItem typings with runtime (v6 backport)#18159
abdelrahmanSheref101 wants to merge 2 commits into
sequelize:v6sequelize/sequelize:v6from
abdelrahmanSheref101:fix/v6-typings-validation-errorabdelrahmanSheref101/sequelize:fix/v6-typings-validation-errorCopy head branch name to clipboard

Conversation

@abdelrahmanSheref101
Copy link
Copy Markdown

Pull Request Checklist

  • Have you added new tests to prevent regressions?
    No — this change is a typing/runtime alignment; existing tests pass. I can add a test if maintainers want one.
  • If a documentation update is necessary, have you opened a PR to the docs repo?
    No — not required for this small typings fix.
  • Did you update the typescript typings accordingly (if applicable)?
    Yes — updated ValidationErrorItemType and the constructor behavior so generated .d.ts matches runtime.
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
    No issue link — described the problem below.
  • Does the name of your PR follow our conventions?
    Yes — fix(types): align ValidationErrorItem typings with runtime (v6 backport).

Description of Changes

The published v6 package shipped .d.ts with lowercase enum keys while runtime throws capitalized type strings (e.g. "notNull Violation", "Validation error"). This caused a mismatch for TypeScript consumers.

This PR backports a minimal, safe fix for v6:

  • Update ValidationErrorItemType enum to use the canonical runtime keys (so generated .d.ts reflects what is actually thrown).
  • Make ValidationErrorItem constructor accept type strings case-insensitively and preserve the original passed form in this.type, while mapping to the canonical origin value internally.

Files changed:

  • packages/core/src/errors/validation-error.ts (enum + constructor logic)

Behavior:

  • Runtime behavior unchanged (tests still expect capitalized runtime strings).
  • Generated .d.ts now matches runtime values, so TypeScript consumers on v6 get correct typings.
  • Backwards-compatible with older clients that used lowercase strings.

List of Breaking Changes

  • None. This is a backwards-compatible typing/runtime alignment.

Testing / How I verified

Locally:

yarn install --immutable
yarn build
yarn test

If you prefer, I can add a small unit/integration test asserting ValidationErrorItem.type for the specific cases; otherwise this remains a focused, low-risk backport.


If you want I can also attach the diff -u output (pack vs. built) to the PR comments.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 16, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3929d670-8bcc-4921-9ce0-edf26a68b4c9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can enforce grammar and style rules using `languagetool`.

Configure the reviews.tools.languagetool setting to enable/disable rules and categories. Refer to the LanguageTool Community to learn more.

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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.