feat: update TypeScript support to 5.8 - 6.0 by WikiRik · Pull Request #18332 · sequelize/sequelize · GitHub
Skip to content

feat: update TypeScript support to 5.8 - 6.0 - #18332

Open
WikiRik wants to merge 2 commits into
WikiRik/typedoc-all-packagesfrom
WikiRik/typescript-6
Open

feat: update TypeScript support to 5.8 - 6.0#18332
WikiRik wants to merge 2 commits into
WikiRik/typedoc-all-packagesfrom
WikiRik/typescript-6

Conversation

@WikiRik

@WikiRik WikiRik commented Sep 3, 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 or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes

Top of the stack, stacked on #18331.

Moves the supported TypeScript range up from 5.55.8 to 5.8, 5.9 and 6.0, and builds on 6.0.2.

ConstraintChecking had to be restructured

TypeScript 6.0 rejects ConstraintChecking.DEFERRED and IMMEDIATE as they were written:

src/deferrable.ts(67,19): error TS4094: Property '#constraints' of exported
anonymous class type may not be private or protected.

Both were class expressions passed straight to classToInvokable inside a static property initializer, so the type they produce has no name to refer to, and a private field cannot be described in the emitted declarations without one. They now have named declarations outside the class body, with the static accessors kept as the documented entry points — which preserves both the class names and the descriptions the generated docs point at.

One observable side effect: DEFERRED and IMMEDIATE become static accessors rather than enumerable data properties, so they no longer appear in Object.keys(ConstraintChecking) or a spread of it. Both are still reached the same way.

cls.test.ts also gains an explicit declare id: CreationOptional<number>, which 6.0 needs to infer the model's creation attributes.

This is the one non-mechanical change in the PR, so it is covered by new unit tests in packages/core/test/unit/deferrable.test.ts: accessor identity, name preservation, construction with and without new, frozen constraints, and isEqual (including that DEFERRED and IMMEDIATE are never equal to each other).

Everything else is mechanical

The @ts-ignore comments that newer compilers no longer need are dropped, and the two in the data types test become @ts-expect-error — which is what their own comments said they were waiting to be:

// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error -- error only appears in TS 5.5+
// @ts-ignore -- intentionally testing invalid input

Ordering

TypeDoc had to reach 0.28 first (#18331); 0.27 refuses to run on TypeScript 6.0 and docs is a required CI job.

Verification

yarn build, yarn test-unit (2220 passing), yarn test-typings across all 13 projects, and yarn docs with no warnings — all on TypeScript 6.0.2.


🤖 Generated with Claude Code

https://claude.ai/code/session_01EgPPfqYYk6PFGbanp5mAFh

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@WikiRik
WikiRik force-pushed the WikiRik/typescript-6 branch 2 times, most recently from 7b11666 to e223edd Compare September 3, 2026 13:13
@WikiRik
WikiRik force-pushed the WikiRik/typescript-6 branch from e223edd to 44cda1a Compare September 3, 2026 16:33
@WikiRik
WikiRik force-pushed the WikiRik/typescript-6 branch from 44cda1a to 5a0b25c Compare September 3, 2026 17:53
@WikiRik
WikiRik force-pushed the WikiRik/typescript-6 branch from 5a0b25c to a74d1e6 Compare September 3, 2026 20:14
Comment thread packages/core/src/deferrable.ts Outdated
Comment thread packages/core/src/deferrable.ts Outdated
@WikiRik
WikiRik marked this pull request as ready for review September 3, 2026 20:18
@WikiRik
WikiRik requested a review from a team as a code owner September 3, 2026 20:18
@WikiRik
WikiRik requested review from ephys and sdepold September 3, 2026 20:18
Rik Smale and others added 2 commits September 3, 2026 22:18
Move the supported range up to 5.8, 5.9 and 6.0, and build on 6.0.2.

TypeScript 6.0 rejects `ConstraintChecking.DEFERRED` and `IMMEDIATE` as they
were written, with "Property '#constraints' of exported anonymous class type may
not be private or protected" (TS4094). Both were class expressions passed
straight to `classToInvokable` inside a static property initializer, so the type
they produce has no name to refer to, and a private field cannot be described in
the emitted declarations without one. Give them named declarations outside the
class body and keep the static accessors as the documented entry points, so the
class names, and the descriptions the documentation points at, are preserved.

Note that this turns `DEFERRED` and `IMMEDIATE` from enumerable static data
properties into accessors, so they no longer show up in `Object.keys` or a
spread of `ConstraintChecking`. Both are still reached the same way.

Cover the two with unit tests in `packages/core/test/unit/deferrable.test.ts`:
accessor identity, name preservation, construction with and without `new`,
frozen constraints, and `isEqual`, including that the two are never equal to
each other.

Drop the `@ts-ignore` comments that newer compilers no longer need, and turn the
two in the data types test into `@ts-expect-error`, which is what they were
waiting to become. The CLS test gains an explicit `id` declaration, which 6.0
needs to infer the model's creation attributes.

TypeDoc must have moved to 0.28 first; 0.27 refuses to run on TypeScript 6.0.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EgPPfqYYk6PFGbanp5mAFh
Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com>
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