Skip to content

feat(typescript)!: support module augmentation of the exposed types - #1147

Merged
redfish4ktc merged 4 commits into
mainfrom
feat/bump_min_ts_for_module_augmentation
Aug 18, 2026
Merged

feat(typescript)!: support module augmentation of the exposed types#1147
redfish4ktc merged 4 commits into
mainfrom
feat/bump_min_ts_for_module_augmentation

Conversation

@redfish4ktc

@redfish4ktc redfish4ktc commented Aug 18, 2026

Copy link
Copy Markdown
Member

Module augmentation of the maxGraph types silently does not work on TypeScript 3.8, where the augmentation overrides the declaration instead of merging with it. TypeScript 3.9 fixes it, so the minimum supported version moves from 3.8 to 3.9, in ts-support as well as in the README and on the website.

TypeScript 3.8 was released in February 2020, 3.9 in May 2020 and 4.0 in August 2020. Both 3.8 and 3.9 are more than six years old, and 3.9 was superseded three months after its release, so most applications already use a newer version and the impact of this breaking change should be limited.

Adds a ts-support check that augments CellStateStyle with a custom style property and passes it to the Stylesheet API through a CellStyle. CellStyle extends CellStateStyle, so augmenting the base interface makes the property available on both, and on everything else built on CellStateStyle (CellState.style, the Stylesheet default and named styles). The check fails if these types go back to being aliases, and a @ts-expect-error on an undeclared property makes sure the augmentation is what lets the rest compile.

BREAKING CHANGE: applications on TypeScript 3.8 must upgrade to 3.9.

Summary by CodeRabbit

  • Documentation

    • Updated TypeScript compatibility guidance: current versions require TypeScript 3.9 or newer.
    • Clarified that version 0.24.0 and earlier support TypeScript 3.8 or newer.
    • Added guidance for applications using TypeScript module augmentation.
  • Tests

    • Added coverage confirming custom cell style properties can be safely extended while undeclared properties remain rejected.

Add a ts-support check that augments CellStyle with a custom style property and uses it against the Stylesheet API.
The check guards the extension point in both directions: it fails if the augmented types go back to being type
aliases, and a @ts-expect-error on an undeclared property makes sure the augmentation is what lets the rest compile,
rather than a type that would accept anything.

Raise the TypeScript version of the ts-support package from 3.8.2 to 3.9.10, and the version documented in the README
and on the website accordingly. Module augmentation is broken on 3.8: the augmented types reach the entry point
through an "export * " re-export, and 3.8 overrides the declaration instead of merging with it, silently leaving the
augmented type with the added property only. Nothing is reported where the augmentation is declared, the failures
surface later as unrelated assignability errors. 3.9 merges as expected.

BREAKING CHANGE:
- The minimum supported TypeScript version is now 3.9, up from 3.8. Applications still on TypeScript 3.8 must
  upgrade to use this release.
@redfish4ktc redfish4ktc added the enhancement New feature or request label Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 33db85fb-9bb2-4f58-ba20-9db8943885df

📥 Commits

Reviewing files that changed from the base of the PR and between 0d3cd59 and 415cf70.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review.


Walkthrough

The PR raises the current minimum TypeScript version to 3.9, updates the TypeScript support package, adds a module augmentation type test, and documents TypeScript 3.8 support for version 0.24.0 and earlier.

Changes

TypeScript compatibility

Layer / File(s) Summary
Module augmentation validation
packages/ts-support/package.json, packages/ts-support/src/module-augmentation.ts
The TypeScript development dependency moves to 3.9.10. The type test validates augmented CellStyle properties and rejects undeclared properties.
Compatibility requirement documentation
CHANGELOG.md, README.md, packages/website/docs/*
The documentation states that current versions require TypeScript 3.9 or newer. Version 0.24.0 and earlier retain TypeScript 3.8 support.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 415cf

This change raises the minimum supported TypeScript version to 3.9 to enable reliable module augmentation and documents the breaking requirement; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies TypeScript module augmentation support and uses valid Conventional Commits syntax for a breaking change.
Description check ✅ Passed The description explains the TypeScript compatibility issue, breaking change, implementation, documentation updates, and test coverage.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/ts-support/src/module-augmentation.ts (1)

17-19: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add coverage for the CellStateStyle API contract.

In packages/core/src/view/style/Stylesheet.ts, Lines 152-154, putCellStyle accepts CellStateStyle. The current test passes a variable already typed as CellStyle, so structural assignability makes the call compile without proving that the custom property is accepted on a CellStateStyle object literal.

Add a CellStateStyle augmentation test that passes an object literal to putCellStyle. Keep the direct CellStyle test as coverage for the exposed interface.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8a7c3bbb-ee10-4a92-9d0d-5de4c8082c52

📥 Commits

Reviewing files that changed from the base of the PR and between 6323419 and a295442.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • CHANGELOG.md
  • README.md
  • packages/ts-support/package.json
  • packages/ts-support/src/module-augmentation.ts
  • packages/website/docs/getting-started.mdx
  • packages/website/docs/intro.md

Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review.

CellStyle extends CellStateStyle, so augmenting the base interface makes the added property available on both, and
on everything else built on CellStateStyle (CellState.style, the Stylesheet default and named styles). Augmenting
CellStyle only proved that the derived type could be extended, which covers fewer of the ways users actually declare
custom style properties.
Readers of the breaking change have no way to judge how disruptive it is without knowing how old TypeScript 3.8 and
3.9 are. State the release dates so they can see that both lines are more than six years old and that few
applications should still be pinned to 3.8.
Drop the patch versions, since the documented minimum is the 3.9 line and not a specific patch, so naming 3.8.2 and
3.9.3 only added noise. Give the dates of the first GA of each line instead, and add TypeScript 4.0 to show that 3.9
was superseded three months after its release, which is what actually tells readers how few applications the bump
affects.
@sonarqubecloud

Copy link
Copy Markdown

@redfish4ktc
redfish4ktc merged commit 67bdd9c into main Aug 18, 2026
6 checks passed
@redfish4ktc
redfish4ktc deleted the feat/bump_min_ts_for_module_augmentation branch August 18, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant