Skip to content

feat: update TypeScript support to 5.8 - 6.0, add typedoc for dialect packages#18209

Draft
WikiRik wants to merge 14 commits into
mainfrom
WikiRik/lockfile
Draft

feat: update TypeScript support to 5.8 - 6.0, add typedoc for dialect packages#18209
WikiRik wants to merge 14 commits into
mainfrom
WikiRik/lockfile

Conversation

@WikiRik
Copy link
Copy Markdown
Member

@WikiRik WikiRik commented Apr 12, 2026

Pull Request Checklist

  • Have you added new tests to prevent regressions?
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
  • Did you update the typescript typings accordingly (if applicable)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes (generated by AI)

Summary

  • Updated Sequelize’s TypeScript support to 5.8, 5.9, and 6.0, and adjusted the codebase to work with newer dependency type surfaces.
  • Expanded TypeDoc generation to cover all packages and fixed API doc link resolution for cross-package symbols.
  • Fixed lockfile maintenance issues without pinning dependencies back, including compatibility fixes in MySQL, Postgres, Snowflake, and MariaDB.
  • Added a Yarn patch for mariadb@3.5.2 because its published typings are broken under this repo’s nodenext TypeScript configuration.
  • Fixed a MariaDB JSON metadata regression and preserved constraint-checking class names for docs/runtime behavior.

Details

  • TypeScript / CI

    • Updated CI typings coverage from 5.5-5.8 to 5.8-6.0.
    • Upgraded typescript to 6.0.2.
    • Removed older @ts-ignore workarounds that are no longer needed with newer TypeScript versions.
    • Updated a few tests and model declarations to satisfy newer compiler checks.
  • TypeDoc / documentation generation

    • Upgraded typedoc to 0.28.19.
    • Upgraded typedoc-plugin-missing-exports to 4.1.3.
    • Changed the TypeDoc build to include all packages, including dialect packages.
    • Added external symbol mappings so generated docs resolve links for APIs such as sql.fn, sql.literal, ValidationError, TimeoutError, InferAttributes, InferCreationAttributes, and decorator helpers.
    • Updated many JSDoc links to fully-qualified @sequelize/core targets so TypeDoc resolves them correctly.
  • mysql2

    • Added enableCleartextPlugin to the supported boolean connection options list.
  • postgres

    • Added fallback_application_name to the supported Postgres connection options.
    • Refined connection-manager typing for newer pg / pg-types.
    • Made parser caching format-aware so text and binary parsers are not reused interchangeably.
    • Restricted Sequelize’s custom array/range parser composition to text mode and let binary mode fall back to pg’s native parsers.
  • snowflake-sdk

    • Added browserRedirectPort to the supported Snowflake connection options.
  • mariadb

    • Updated Sequelize’s MariaDB type imports to the package’s newer type export locations.
    • Patched mariadb@3.5.2 declaration imports from ./share to ./share.js so TypeScript can resolve them under moduleResolution: nodenext.
    • Fixed JSON result parsing to match metadata by the selected column name instead of relying on column order.
  • Associations / constraint checking

    • Changed Association.foreignKey to a getter and updated BelongsToAssociation to store it privately for better type/runtime consistency.
    • Refactored ConstraintChecking.DEFERRED and ConstraintChecking.IMMEDIATE so their class names are preserved correctly.
  • Shared utility

    • Narrowed getSynchronizedTypeKeys to string keys only, which matches Object.keys(...) behavior and avoids newer dependency key-type mismatches.

Notes

  • No dependency versions were pinned back to older releases.
  • The MariaDB fix is intentionally implemented as a Yarn patch rather than weakening TypeScript checks with skipLibCheck.
  • This PR also includes the lockfile and related dependency updates required to make the new TypeScript and TypeDoc setup build cleanly.

Summary by CodeRabbit

  • New Features

    • Added connection option support for MySQL (enableCleartextPlugin), PostgreSQL (fallback_application_name), and Snowflake (browserRedirectPort).
    • Enhanced PostgreSQL type parsing with format-aware caching.
  • Bug Fixes

    • Fixed MariaDB JSON column detection in query results.
  • Refactor

    • Changed Association.foreignKey from property to read-only getter.
    • Updated ConstraintChecking.DEFERRED and IMMEDIATE to static accessors.
  • Dependencies

    • Updated TypeScript to 6.0.2, MariaDB driver, and related dev tools.
  • Documentation

    • Improved JSDoc references across SQL expression builders and error types.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

Important

Review skipped

Draft detected.

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: 7300f0f3-5065-4d04-a57f-eabdbc8d44f6

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
📝 Walkthrough

Walkthrough

This PR updates TypeScript version targets to 6.0, bumps related dev dependencies, refactors several APIs from properties to getters for encapsulation, updates JSDoc references to use fully-qualified namespaces, expands TypeDoc configuration, and makes targeted improvements to database dialect implementations.

Changes

Cohort / File(s) Summary
CI and Dependencies
.github/workflows/ci.yml, package.json
Updated TypeScript CI matrix to test versions 5.8, 5.9, and 6.0. Bumped dev dependencies: TypeScript 5.8.3→6.0.2, typedoc 0.27.9→0.28.19, typedoc-plugin-missing-exports 3.1.0→4.1.3.
JSDoc Reference Updates
packages/core/src/abstract-dialect/query-generator-typescript.ts, packages/core/src/abstract-dialect/query-generator.js, packages/core/src/expression-builders/*.ts, packages/core/src/model.js, packages/core/src/sequelize-typescript.ts, packages/core/src/sequelize.d.ts, packages/core/src/sequelize.internals.ts, packages/core/src/sequelize.js
Systematically updated JSDoc @link and deprecation references to use fully-qualified @sequelize/core! namespace paths instead of unqualified sql.* references across expression builders (attribute, cast, col, fn, identifier, json-path, etc.) and core classes.
Type System and Encapsulation Refactoring
packages/core/src/associations/base.ts, packages/core/src/associations/belongs-to.ts, packages/core/src/deferrable.ts, packages/utils/src/common/get-synchronized-type-keys.ts
Converted Association.foreignKey from abstract property to abstract getter; made BelongsToAssociation.foreignKey private with read-only getter; changed ConstraintChecking.DEFERRED/IMMEDIATE from static readonly to static getters; restricted getSynchronizedTypeKeys to string-only keys.
TypeScript Suppression Cleanup
packages/core/src/decorators/shared/model.ts, packages/core/src/model-definition.ts
Removed @ts-ignore and eslint-disable comments around array merging and hook concatenation logic, allowing TypeScript type checking on previously suppressed code.
Model and Type Definitions
packages/core/src/model.d.ts, packages/core/test/integration/cls.test.ts, packages/core/test/integration/data-types/data-types.test.ts
Updated WhereOperators[Op.contains] type expression formatting; refined JSDoc links to namespaced exports; declared id as CreationOptional<number> in test model; replaced @ts-ignore with @ts-expect-error in intentional type-error tests.
TypeDoc Configuration
typedoc.base.json, typedoc.js
Added externalSymbolLinkMappings to resolve @sequelize/core symbols to documentation paths. Expanded TypeDoc entryPoints to include all dialect packages (db2, ibmi, mariadb, mssql, mysql, oracle, postgres, snowflake, sqlite3).
MariaDB Dialect Enhancements
packages/mariadb/package.json, packages/mariadb/src/_internal/data-types-db.ts, packages/mariadb/src/connection-manager.ts, packages/mariadb/src/query.js
Updated mariadb dependency to use Yarn patch (3.5.2). Changed FieldInfo import from mariadb to mariadb/types/share.js. Updated connection manager type imports and method signatures. Refactored handleJsonSelectQuery to use name-based column lookup instead of positional indexing for metadata matching.
MySQL Dialect Updates
packages/mysql/src/_internal/connection-options.ts
Added enableCleartextPlugin to BOOLEAN_CONNECTION_OPTION_MAP, extending recognized boolean connection options.
PostgreSQL Dialect Refactoring
packages/postgres/src/_internal/connection-options.ts, packages/postgres/src/connection-manager.ts
Added fallback_application_name to string connection options. Major refactor of type parser caching: changed cache key from OID-only to composite format:oid key; introduced TextTypeParser and BinaryTypeParser type aliases; updated getTypeParser with format-based overloads; refactored connection error handling with typed switch statement.
Snowflake Dialect Updates
packages/snowflake/src/dialect.ts
Added browserRedirectPort to supported connection option names, expanding dialect's advertised connection options.
MSSQL Dependency Update
packages/mssql/package.json
Updated tedious dependency from ^19.1.2 to ^19.2.1.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested reviewers

  • sdepold
  • ephys

🐰 TypeScript grows, our types align,
Getters now encapsulate the line,
Six-point-oh flows through every test,
Documentation links are now the best!
Dialects dance with options new,
A refactor's dream, through and through!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically describes the main objectives of the PR: updating TypeScript support to versions 5.8-6.0 and adding TypeDoc for dialect packages, which align with the primary changes across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch WikiRik/lockfile

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.

@WikiRik WikiRik changed the title fix: update lockfile and update more dialect adapters feat: update TypeScript support to 5.8 - 6.0 Apr 13, 2026
@WikiRik WikiRik changed the title feat: update TypeScript support to 5.8 - 6.0 feat: update TypeScript support to 5.8 - 6.0, add typedoc for dialect packages Apr 13, 2026
@WikiRik
Copy link
Copy Markdown
Member Author

WikiRik commented Apr 13, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/postgres/src/connection-manager.ts (1)

393-407: Consider simplifying the redundant conditional checks.

The textFormat === 'text' conditionals on lines 395 and 403 are always true or the check is unnecessary since textFormat is either 'text' or undefined, and both branches call getTypeParser with compatible arguments.

♻️ Suggested simplification
    if (typeData.type === 'range-array') {
-      return this.#buildArrayParser(
-        textFormat === 'text'
-          ? this.getTypeParser(typeData.rangeOid!, textFormat)
-          : this.getTypeParser(typeData.rangeOid!),
-      );
+      return this.#buildArrayParser(this.getTypeParser(typeData.rangeOid!, 'text'));
    }

    if (typeData.type === 'array') {
-      return this.#buildArrayParser(
-        textFormat === 'text'
-          ? this.getTypeParser(typeData.baseOid!, textFormat)
-          : this.getTypeParser(typeData.baseOid!),
-      );
+      return this.#buildArrayParser(this.getTypeParser(typeData.baseOid!, 'text'));
    }

Since #getCustomTypeParser returns null for binary format (line 381-383), this method only runs for text format. Always passing 'text' explicitly is clearer and removes the conditional.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/postgres/src/connection-manager.ts` around lines 393 - 407, The
redundant ternary checks on textFormat in the array handling should be removed:
since `#getCustomTypeParser` returns null for binary, this code only runs for
text, so always call getTypeParser with the explicit 'text' argument and pass
its result to `#buildArrayParser`; update both branches handling typeData.type ===
'range-array' and typeData.type === 'array' to call
`#buildArrayParser`(getTypeParser(typeData.rangeOid!,'text')) and
`#buildArrayParser`(getTypeParser(typeData.baseOid!,'text')) respectively,
eliminating the conditional and keeping existing symbols (`#buildArrayParser`,
getTypeParser, typeData.rangeOid, typeData.baseOid, typeData.type).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Around line 104-107: The package.json currently pins "typescript": "6.0.2"
which is incompatible with the older ts-node tool; update package.json to remove
or replace ts-node usage by switching dev-dependency and any scripts referencing
"ts-node" to a TypeScript 6-compatible runner (for example replace the ts-node
devDependency with "tsx" and update scripts that call "ts-node" to call "tsx"
instead), or if you must keep ts-node add a clear comment and constrain
TypeScript to a compatible version (<6.0) and/or change scripts to use "ts-node
--swc" as a partial workaround; locate references to the package name "ts-node"
in package.json scripts and devDependencies and update them accordingly.

---

Nitpick comments:
In `@packages/postgres/src/connection-manager.ts`:
- Around line 393-407: The redundant ternary checks on textFormat in the array
handling should be removed: since `#getCustomTypeParser` returns null for binary,
this code only runs for text, so always call getTypeParser with the explicit
'text' argument and pass its result to `#buildArrayParser`; update both branches
handling typeData.type === 'range-array' and typeData.type === 'array' to call
`#buildArrayParser`(getTypeParser(typeData.rangeOid!,'text')) and
`#buildArrayParser`(getTypeParser(typeData.baseOid!,'text')) respectively,
eliminating the conditional and keeping existing symbols (`#buildArrayParser`,
getTypeParser, typeData.rangeOid, typeData.baseOid, typeData.type).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 632c1279-ec9a-48fd-805e-49839d899c2c

📥 Commits

Reviewing files that changed from the base of the PR and between ab2c9ad and 766c776.

⛔ Files ignored due to path filters (2)
  • .yarn/patches/mariadb-npm-3.5.2-52603499c8.patch is excluded by !**/.yarn/**
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (43)
  • .github/workflows/ci.yml
  • package.json
  • packages/core/src/abstract-dialect/query-generator-typescript.ts
  • packages/core/src/abstract-dialect/query-generator.js
  • packages/core/src/associations/base.ts
  • packages/core/src/associations/belongs-to.ts
  • packages/core/src/decorators/shared/model.ts
  • packages/core/src/deferrable.ts
  • packages/core/src/expression-builders/attribute.ts
  • packages/core/src/expression-builders/cast.ts
  • packages/core/src/expression-builders/col.ts
  • packages/core/src/expression-builders/dialect-aware-fn.ts
  • packages/core/src/expression-builders/fn.ts
  • packages/core/src/expression-builders/identifier.ts
  • packages/core/src/expression-builders/json-path.ts
  • packages/core/src/expression-builders/json.ts
  • packages/core/src/expression-builders/list.ts
  • packages/core/src/expression-builders/literal.ts
  • packages/core/src/expression-builders/random.ts
  • packages/core/src/expression-builders/sql.ts
  • packages/core/src/expression-builders/value.ts
  • packages/core/src/expression-builders/where.ts
  • packages/core/src/model-definition.ts
  • packages/core/src/model.d.ts
  • packages/core/src/model.js
  • packages/core/src/sequelize-typescript.ts
  • packages/core/src/sequelize.d.ts
  • packages/core/src/sequelize.internals.ts
  • packages/core/src/sequelize.js
  • packages/core/test/integration/cls.test.ts
  • packages/core/test/integration/data-types/data-types.test.ts
  • packages/mariadb/package.json
  • packages/mariadb/src/_internal/data-types-db.ts
  • packages/mariadb/src/connection-manager.ts
  • packages/mariadb/src/query.js
  • packages/mssql/package.json
  • packages/mysql/src/_internal/connection-options.ts
  • packages/postgres/src/_internal/connection-options.ts
  • packages/postgres/src/connection-manager.ts
  • packages/snowflake/src/dialect.ts
  • packages/utils/src/common/get-synchronized-type-keys.ts
  • typedoc.base.json
  • typedoc.js
💤 Files with no reviewable changes (2)
  • packages/core/src/decorators/shared/model.ts
  • packages/core/src/model-definition.ts

Comment thread package.json
@WikiRik
Copy link
Copy Markdown
Member Author

WikiRik commented Apr 14, 2026

I've undone the suggestion by coderabbit to replace ts-node and will bring it back in another PR. This is large enough as it is

@WikiRik WikiRik marked this pull request as ready for review April 14, 2026 11:45
@WikiRik WikiRik requested a review from a team as a code owner April 14, 2026 11:45
@WikiRik WikiRik requested review from ephys and sdepold April 14, 2026 11:45
Copy link
Copy Markdown
Member

@ephys ephys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First review

Comment thread packages/mariadb/package.json Outdated
"dayjs": "^1.11.20",
"lodash": "^4.18.1",
"mariadb": "^3.4.5",
"mariadb": "patch:mariadb@npm%3A3.5.2#~/.yarn/patches/mariadb-npm-3.5.2-52603499c8.patch",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we sure this is safe? It works in our installs, but does it work for our users? In all package managers?

Copy link
Copy Markdown
Member Author

@WikiRik WikiRik Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I forgot that we're shipping this together with the package for the user. This will break for non-yarn instances

Copy link
Copy Markdown
Member Author

@WikiRik WikiRik Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reverted the changes and pinned it to 3.4.5 until either the upstream fixes it or we deal with it another way.

EDIT: I've opened a PR to the upstream which should hopefully fix our issue.

Comment thread packages/mariadb/src/query.js Outdated
Comment thread packages/mariadb/src/query.js Outdated
@WikiRik WikiRik marked this pull request as draft April 19, 2026 09:26
WikiRik and others added 2 commits April 19, 2026 11:27
Co-authored-by: Alyx <zoe@ephys.dev>
Drop the Yarn patch-based MariaDB dependency so published installs remain package-manager agnostic. Restore the pre-patch typings setup and pin 3.4.5 until the upstream type exports are fixed.
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.

2 participants