Skip to content

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

Closed
WikiRik wants to merge 17 commits into
mainfrom
WikiRik/lockfile
Closed

WikiRik wants to merge 17 commits into
mainfrom
WikiRik/lockfile

Conversation

@WikiRik

@WikiRik WikiRik commented Apr 12, 2026 •

Copy link
Copy Markdown
Member

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.
  • Refreshed the lockfile and the dialect drivers without pinning dependencies back, including compatibility fixes in MySQL, Postgres, Snowflake, and MariaDB.
  • 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

    • Bumped the driver to ^3.5.3, whose published declarations resolve under this repo's moduleResolution: nodenext. No Yarn patch and no skipLibCheck is needed for it.
    • Fixed JSON result parsing to match metadata by the selected column instead of relying on column order. The check uses the driver's public isDataTypeFormatJson() rather than its private _dataTypeFormat field, and the fallback match on a column's original name is qualified by the table it comes from, so an include cannot match a same-named column of another table.
    • Described handleJsonSelectQuery in the package's hand-written declarations.
  • 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, keeping their descriptions on the static accessors that the generated docs point at.
  • Shared utility

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

Tests

  • packages/mariadb/src/query.test.ts covers handleJsonSelectQuery: metadata matched by column rather than by the position of the attribute in the model, the json-format guard, the aliased-column fallback and its table qualification, and the case where no metadata describes the column.
  • packages/postgres/src/connection-manager.test.ts covers the format-aware parser cache, including that a text parser is never handed out for the binary format, or the other way around.
  • packages/core/test/unit/deferrable.test.ts covers ConstraintChecking.DEFERRED and IMMEDIATE: accessor identity, name preservation, construction with and without new, frozen constraints, and isEqual.

Notes

  • node-gyp is held at 11.5.0 through a resolution, because node-gyp@latest is now 13, which requires Node >= 22, while CI still tests Node 20. No other dependency versions were pinned back to older releases.
  • 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

coderabbitai Bot commented Apr 12, 2026 •

Copy link
Copy Markdown
Contributor
📝 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
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%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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.

@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

WikiRik commented Apr 13, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Apr 13, 2026

Copy link
Copy Markdown
Contributor
✅ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 Resolved
@WikiRik

WikiRik commented Apr 14, 2026

Copy link
Copy Markdown
Member Author

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

@ephys ephys left a comment

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.

First review

Comment thread packages/mariadb/package.json Resolved
Comment thread packages/mariadb/src/query.js Resolved
Comment thread packages/mariadb/src/query.js Resolved
renovate Bot and others added 15 commits July 29, 2026 13:32
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.
`_dataTypeFormat` is a private field of the driver's `ColumnDefinition` and is
absent from its published typings. `isDataTypeFormatJson()` is public and does
exactly the same comparison, so use that instead.

Qualify the `orgName()` fallback by the table the column originates from. It is
only reached when a column was aliased, and without the qualification a joined
table could match it with a column that happens to share its original name.

Cover `handleJsonSelectQuery` with unit tests, and describe it in the package's
hand-written declarations so they can be typed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Rik Smale and others added 2 commits July 29, 2026 18:31
`getTypeParser` treats a missing format as the text format, so the branches that
distinguished `'text'` from `undefined` all resolved to the same call. Keep only
the narrowing the per-format overloads actually require.

Cover the format-aware parser cache with unit tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Moving DEFERRED and IMMEDIATE out of the class body left their descriptions on
the constructors, so the symbols the documentation points at, the static
accessors, ended up without one.

Cover the accessors with unit tests.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@WikiRik

WikiRik commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Split up in the stack #18328 #18329 #18330 #18331 #18332

@WikiRik WikiRik closed this Sep 3, 2026
@WikiRik
WikiRik deleted the WikiRik/lockfile branch September 3, 2026 20:19
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