Skip to content

Grids: convert the pivot grid LocalStore into an ES6 class and remove the Class.inherit leftovers - #35411

Open
EugeniyKiyashko wants to merge 2 commits into
mainfrom
typescript/grids/es6_inherit_598
Open

EugeniyKiyashko wants to merge 2 commits into
mainfrom
typescript/grids/es6_inherit_598

Conversation

@EugeniyKiyashko

Copy link
Copy Markdown
Contributor

No description provided.

… the Class.inherit leftovers in grid_core modules, the pivot data source and QUnit tests
Copilot AI balanced review requested due to automatic review settings September 29, 2026 21:53
@EugeniyKiyashko EugeniyKiyashko self-assigned this Sep 29, 2026
@EugeniyKiyashko
EugeniyKiyashko requested review from a team as code owners September 29, 2026 21:53

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

The new LocalStore.filter forwarding fails TypeScript overload checking with an unknown[] argument list.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Modernizes PivotGrid storage and grid module extension code by removing legacy Class.inherit patterns.

Changes:

  • Converts PivotGrid LocalStore and test stores to ES6 classes.
  • Detects custom PivotGrid stores by their required methods.
  • Removes object-based grid extenders and obsolete test comments.
File Description
packages/​devextreme/​js/​__internal/​grids/​pivot_grid/​local_store/​m_local_store.ts Converts LocalStore to an ES6 class.
packages/​devextreme/​js/​__internal/​grids/​pivot_grid/​data_source/​m_data_source.ts Adds method-based custom store detection.
packages/​devextreme/​js/​__internal/​grids/​grid_core/​m_modules.ts Removes legacy object extender handling.
packages/​devextreme/​js/​__internal/​grids/​grid_core/​m_types.ts Restricts extenders to class-producing functions.
packages/​devextreme/​testing/​tests/​DevExpress.ui.widgets.pivotGrid/​dataController.tests.js Converts mock stores to ES6 classes.
packages/​devextreme/​testing/​tests/​DevExpress.ui.widgets.dataGrid/​grid_core.modules.tests.js Removes obsolete legacy-class examples.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

type ControllersExtender = {
[P in keyof Controllers]: ((Base: ModuleType<Controllers[P]>) => ModuleType<Controllers[P]>)
| Record<string, any>;
[P in keyof Controllers]: (Base: ModuleType<any>) => ModuleType<Controllers[P]>;

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.

lets return here prev more strict type and add ts-expect-error to a single place where the typing will fail (packages/devextreme/js/__internal/grids/grid_core/adaptivity/adaptivity_module.ts)

Suggested change
[P in keyof Controllers]: (Base: ModuleType<any>) => ModuleType<Controllers[P]>;
[P in keyof Controllers]: (Base: ModuleType<Controllers[P]>) => ModuleType<Controllers[P]>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in ae48aa6: both extender maps are strict again and the single registration that no longer type-checks (adaptivity_module.ts, data) carries a @ts-expect-error. tsc and eslint are clean.

type ViewsExtender = {
[P in keyof Views]: ((Base: ModuleType<Views[P]>) => ModuleType<Views[P]>)
| Record<string, any>;
[P in keyof Views]: (Base: ModuleType<any>) => ModuleType<Views[P]>;

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.

Suggested change
[P in keyof Views]: (Base: ModuleType<any>) => ModuleType<Views[P]>;
[P in keyof Views]: (Base: ModuleType<Views[P]>) => ModuleType<Views[P]>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in ae48aa6.

const classType = currentType as { inherit: (type: unknown) => unknown };
extendTypes[name] = classType.inherit(extender);
}
if (currentType && isFunction(extender)) {

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.

With the .inherit branch gone, the guard turns a non-function extender into a silent no-op. DataGrid.registerModule / TreeList.registerModule can be called at runtime even though it is not public API

  • before this PR: TypeError: classType.inherit is not a function (since 24.1)
  • with this PR: the grid is created, the extender is ignored, and the customization quietly does nothing

Without the guard it still fails loudly: TypeError: extender is not a function, thrown synchronously from new DataGrid(...) (_init → processModules → here)

Suggested change
if (currentType && isFunction(extender)) {
if (currentType) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in ae48aa6. The literal if (currentType) does not compile while moduleExtenders is Record<string, unknown> (TS18046), so the parameter is now typed as Record<string, ModuleTypeExtender | undefined>: a non-function extender fails with TypeError: extender is not a function, and an explicitly undefined entry is skipped like a missing key (Partial allows it).

Copilot AI balanced review requested due to automatic review settings September 30, 2026 13:39

Copilot AI 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.

Copilot review overview

🟢 Approval recommended

The conversion is consistent, preserves existing behavior, and updates relevant tests and types.

Review effort: Balanced
Findings: None

Resolved since last review (1)

This branch has not been deployed

No deployments
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.

3 participants