| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Enable @typescript-eslint/consistent-type-definitions with the "interface" option and convert the 27 declarations it reports across 14 files, mostly in packages/core/src/types.ts. CellStyle is converted by hand, since it was an intersection and the rule therefore did not flag it. Beyond consistency, interfaces support module augmentation while type aliases do not. Consumers can now declare their own style properties on CellStateStyle and on CellStyle instead of casting or widening the style objects. This was impossible before, the augmentation was rejected with "Duplicate identifier". CellStyle extends CellStateStyle rather than intersecting it, so it is augmentable on its own while the inheritance stays one-way: a property added to CellStyle does not leak onto CellStateStyle. The only visible difference for TypeScript consumers is that an interface has no implicit index signature, so these types are no longer implicitly assignable to Record<string, unknown>. The single occurrence in this repository is in StyleSheet.test.ts, where the CellStyle cast passed to expect.objectContaining becomes a satisfies clause. This keeps the literal checked against CellStyle while leaving it with the index signature the matcher requires. The change is documented in the CHANGELOG under "Other Changes", as it is not a breaking change for the vast majority of consumers and does not affect JavaScript users at all.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 340269c2-fe52-4347-aac8-9b63e5dc3567 📥 CommitsReviewing files that changed from the base of the PR and between 796c848 and e332d74. 📒 Files selected for processing (1)
Included review availability: Your plan includes up to 4 reviews per rolling hour; 3 remain after this review. WalkthroughThe change converts object-shaped TypeScript type aliases to interfaces across core declarations and supporting code. ESLint now enforces interface declarations. Tests and the changelog document the updated syntax and TypeScript behavior. ChangesInterface Migration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: 🟡 Moderate · up to e332d The updated declarations may prevent React 19 consumers from compiling because they reference the removed global JSX namespace. Merge should wait for that compatibility issue to be fixed or explicitly accepted by the owner. Possibly related PRs
❌ Failed checks (1 warning)
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. ❤️ ShareComment @coderabbitai help to get the list of available commands. |
Sorry, something went wrong.
There was a problem hiding this comment.
Actionable comments posted: 1
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 32466c7a-1f80-4128-b0de-478c106259dc
📥 CommitsReviewing files that changed from the base of the PR and between 255ad00 and 796c848.
📒 Files selected for processing (17)Included review availability: Your plan includes up to 4 reviews per rolling hour; 2 remain after this review.
Sorry, something went wrong.
Apply the rule of this branch to the two extension-point aliases of the stylesheet tests, which the linter did not report because they were intersections. Document why these tests do not use module augmentation, even though it is now possible and is what an application would do: an augmentation applies to the whole TypeScript program, so the custom properties would leak into every other test of the package and silently weaken them.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem
Object types exposed by the package were declared with type aliases. Beyond the inconsistency with the declarations already using interface, a type alias cannot be extended with module augmentation: a consumer trying to declare an extra style property gets a TS2300 Duplicate identifier error. The only workarounds were casting or widening the style objects at every call site.
Changes
Enable @typescript-eslint/consistent-type-definitions with the interface option in eslint.config.mjs. The rule sits in the shared rules block, so it applies to every package, not only core.
Convert the declarations it reports, 27 across 14 files, mostly in packages/core/src/types.ts. The conversion is mechanical and was produced with eslint --fix.
CellStyle is converted by hand: it was an intersection (CellStateStyle & { ... }), a form the rule does not flag, and it is now interface CellStyle extends CellStateStyle. Two other intersections, GraphOptions and IdentityObject, are left as type aliases.
New extension point
Applications can now declare their own style properties:
Since CellStyle extends CellStateStyle, the declaration above applies to both. CellStyle can also be augmented on its own when the property only makes sense on the style declared on a cell and not on the computed state style. The inheritance stays one-way, so such a property does not leak onto CellStateStyle.
Both directions were checked by compiling an augmentation against the generated .d.ts files, including a @ts-expect-error on the leak case.
Impact for consumers
Not a breaking change for the vast majority of consumers, and JavaScript users are not impacted at all. This is documented in the CHANGELOG under Other Changes.
The only TypeScript behavior that differs is that an interface has no implicit index signature, so these types are no longer implicitly assignable to Record<string, unknown> or to a similar index-signature type.
The single occurrence in this repository is in StyleSheet.test.ts, where the CellStyle cast passed to expect.objectContaining becomes a satisfies clause. This keeps the literal checked against CellStyle while leaving it with the index signature the matcher requires.
Validation
The full CI chain was run locally: build -w packages/core, test-check -w packages/core, 561 tests in packages/core, test -w packages/ts-support, build-all-examples.bash, build -w packages/html, check:circular-dependencies, check:npm-package and lint. Example bundle sizes are unchanged.
Note on scope
packages/website contains one .tsx file with a violation, which is fixed here. It is not covered by the CI though: the lint script glob is **/*.ts, which does not match .tsx. Extending it would surface 3 unrelated pre-existing @typescript-eslint/no-require-imports errors in that same file, so it is left for a separate change.
Summary by CodeRabbit
Documentation
Developer Experience