Skip to content

d.ts - Replace [Smth]Options members of 'Function' type (smthExpr) to more specific to keep exact signature in generated wrappers#33285

Open
dmlvr wants to merge 12 commits intoDevExpress:26_1from
dmlvr:26_1_3814_replace_Function_in_d.ts
Open

d.ts - Replace [Smth]Options members of 'Function' type (smthExpr) to more specific to keep exact signature in generated wrappers#33285
dmlvr wants to merge 12 commits intoDevExpress:26_1from
dmlvr:26_1_3814_replace_Function_in_d.ts

Conversation

@dmlvr
Copy link
Copy Markdown
Contributor

@dmlvr dmlvr commented Apr 15, 2026

No description provided.

@github-actions github-actions bot added the .d.ts label Apr 15, 2026
@dmlvr dmlvr force-pushed the 26_1_3814_replace_Function_in_d.ts branch from d876066 to e8042a5 Compare April 15, 2026 13:54
@dmlvr dmlvr self-assigned this Apr 15, 2026
@dmlvr dmlvr force-pushed the 26_1_3814_replace_Function_in_d.ts branch from 128a088 to 2c61fc3 Compare April 16, 2026 11:37
@dmlvr dmlvr changed the title update keyExpr type d.ts - Replace dxXXXOptions members of 'Function' type to more specific to keep exact signature in generated wrappers Apr 17, 2026
@dmlvr dmlvr marked this pull request as ready for review April 17, 2026 07:27
@dmlvr dmlvr requested a review from a team as a code owner April 17, 2026 07:27
Copilot AI review requested due to automatic review settings April 17, 2026 07:27
@dmlvr dmlvr requested a review from a team as a code owner April 17, 2026 07:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens TypeScript declaration types for various *Expr options across DevExtreme core .d.ts files and the generated Angular/React/Vue wrappers, replacing broad Function types with explicit callable signatures to preserve more exact typings in wrapper generation.

Changes:

  • Replaced Function-typed *Expr members with explicit function signatures in core .d.ts files (and dx.all.d.ts).
  • Updated generated Angular/React/Vue wrapper prop/input typings to reflect the new callable signatures.
  • Adjusted related option typings for TreeView/TreeList/Gantt/FileManagement and Collection/Hierarchical widgets.

Reviewed changes

Copilot reviewed 43 out of 53 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/devextreme/ts/dx.all.d.ts Aggregated declarations updated to use explicit callback signatures instead of Function.
packages/devextreme/js/ui/tree_view.d.ts TreeView option *Expr callback typings updated.
packages/devextreme/js/ui/tree_list.d.ts TreeList option *Expr callback typings updated.
packages/devextreme/js/ui/tab_panel.d.ts TabPanel keyExpr typing updated.
packages/devextreme/js/ui/hierarchical_collection/ui.hierarchical_collection_widget.d.ts Hierarchical widget *Expr callback typings updated.
packages/devextreme/js/ui/gantt.d.ts Gantt nested *Expr callback typings updated.
packages/devextreme/js/ui/collection/ui.collection_widget.base.d.ts Collection widget keyExpr typing updated.
packages/devextreme/js/ui/button_group.d.ts ButtonGroup keyExpr typing updated (and imports adjusted).
packages/devextreme/js/file_management/provider_base.d.ts File management provider base *Expr callback typings updated.
packages/devextreme/js/file_management/object_provider.d.ts Object provider contentExpr/itemsExpr callback typings updated.
packages/devextreme-vue/src/tree-view.ts Vue TreeView prop typings updated for *Expr options.
packages/devextreme-vue/src/tree-list.ts Vue TreeList/TabPanel options prop typings updated for *Expr options.
packages/devextreme-vue/src/tabs.ts Vue Tabs prop typing updated for keyExpr.
packages/devextreme-vue/src/tab-panel.ts Vue TabPanel prop typing updated for keyExpr.
packages/devextreme-vue/src/scheduler.ts Vue Scheduler nested option prop typings updated for keyExpr.
packages/devextreme-vue/src/menu.ts Vue Menu prop typings updated for disabledExpr/itemsExpr/selectedExpr.
packages/devextreme-vue/src/list.ts Vue List prop typing updated for keyExpr.
packages/devextreme-vue/src/gantt.ts Vue Gantt nested option prop typings updated for multiple *Expr options.
packages/devextreme-vue/src/form.ts Vue Form nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-vue/src/data-grid.ts Vue DataGrid nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-vue/src/context-menu.ts Vue ContextMenu prop typings updated for disabledExpr/itemsExpr/selectedExpr.
packages/devextreme-vue/src/chat.ts Vue Chat nested suggestions prop typing updated for keyExpr.
packages/devextreme-vue/src/card-view.ts Vue CardView nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-vue/src/button-group.ts Vue ButtonGroup prop typing updated for keyExpr.
packages/devextreme-vue/src/accordion.ts Vue Accordion prop typing updated for keyExpr.
packages/devextreme-react/src/tree-list.ts React TreeList nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-react/src/scheduler.ts React Scheduler option typings updated for keyExpr (incl. nested TabPanel options).
packages/devextreme-react/src/gantt.ts React Gantt nested option prop typings updated for multiple *Expr options.
packages/devextreme-react/src/form.ts React Form nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-react/src/data-grid.ts React DataGrid nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-react/src/chat.ts React Chat nested suggestions prop typing updated for keyExpr.
packages/devextreme-react/src/card-view.ts React CardView nested TabPanel options prop typing updated for keyExpr.
packages/devextreme-angular/src/ui/tree-view/index.ts Angular TreeView inputs/outputs updated for *Expr callback typings.
packages/devextreme-angular/src/ui/tree-list/nested/tab-panel-options.ts Angular TreeList nested TabPanel options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/tree-list/index.ts Angular TreeList inputs/outputs updated for *Expr callback typings.
packages/devextreme-angular/src/ui/tabs/index.ts Angular Tabs input/output typing updated for keyExpr.
packages/devextreme-angular/src/ui/tab-panel/index.ts Angular TabPanel input/output typing updated for keyExpr.
packages/devextreme-angular/src/ui/scheduler/nested/tab-panel-options.ts Angular Scheduler nested TabPanel options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/scheduler/nested/options.ts Angular Scheduler nested options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/menu/index.ts Angular Menu inputs/outputs updated for disabledExpr/itemsExpr/selectedExpr typings.
packages/devextreme-angular/src/ui/list/index.ts Angular List input/output typing updated for keyExpr.
packages/devextreme-angular/src/ui/gantt/nested/tasks.ts Angular Gantt Tasks nested option inputs updated for *Expr typings.
packages/devextreme-angular/src/ui/gantt/nested/resources.ts Angular Gantt Resources nested option inputs updated for *Expr typings.
packages/devextreme-angular/src/ui/gantt/nested/resource-assignments.ts Angular Gantt ResourceAssignments nested option inputs updated for *Expr typings.
packages/devextreme-angular/src/ui/gantt/nested/dependencies.ts Angular Gantt Dependencies nested option inputs updated for *Expr typings.
packages/devextreme-angular/src/ui/gantt/index.ts Angular Gantt inputs/outputs updated for nested *Expr option object typings.
packages/devextreme-angular/src/ui/form/nested/tab-panel-options.ts Angular Form nested TabPanel options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/data-grid/nested/tab-panel-options.ts Angular DataGrid nested TabPanel options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/context-menu/index.ts Angular ContextMenu inputs/outputs updated for disabledExpr/itemsExpr/selectedExpr typings.
packages/devextreme-angular/src/ui/chat/nested/suggestions.ts Angular Chat Suggestions nested option input typing updated for keyExpr.
packages/devextreme-angular/src/ui/card-view/nested/tab-panel-options.ts Angular CardView nested TabPanel options input typing updated for keyExpr.
packages/devextreme-angular/src/ui/button-group/index.ts Angular ButtonGroup input/output typing updated for keyExpr.
packages/devextreme-angular/src/ui/accordion/index.ts Angular Accordion input/output typing updated for keyExpr.

Comment thread packages/devextreme-vue/src/tree-view.ts
Comment thread packages/devextreme-angular/src/ui/tree-view/index.ts
Comment thread packages/devextreme-angular/src/ui/tree-view/index.ts Outdated
Comment thread packages/devextreme-vue/src/tree-view.ts Outdated
Comment thread packages/devextreme-react/src/gantt.ts
Comment thread packages/devextreme-vue/src/gantt.ts
} from '../events';

import {
CollectionWidgetOptions,
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.

unused?

mpreyskurantov
mpreyskurantov previously approved these changes Apr 17, 2026
@mpreyskurantov mpreyskurantov changed the title d.ts - Replace dxXXXOptions members of 'Function' type to more specific to keep exact signature in generated wrappers d.ts - Replace [Smth]Options members of 'Function' type (smthExpr) to more specific to keep exact signature in generated wrappers Apr 17, 2026
* @public
*/
itemsExpr?: string | Function;
itemsExpr?: string | ((item: TRowData, value?: any) => TKey);
Copy link
Copy Markdown
Contributor

@Tucchhaa Tucchhaa Apr 20, 2026

Choose a reason for hiding this comment

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

If itemsExpr is a function, then it accepts only one parameter, according to this code (there are no other usages of itemsGetter).

Moreover, it should return an array of items, not the key.

So the type should be:

itemsExpr?: string | ((item: TRowData) => TRowData[]);

* @public
*/
parentIdExpr?: string | Function;
parentIdExpr?: string | ((item: TRowData, value?: any) => TKey);
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.

if parentIdExpr is function, then it accepts only one parameter (check usages of _parentIdGetter in this file).

So its type should be this:

parentIdExpr?: string | ((item: TRowData) => TKey);

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.

Here _parentIdSetter called with two arguments (item, value).
In createParentIdSetter, when parentIdExpr is a function, it is returned as-is, so the same user callback is used as a setter too.

Therefore, I think parentIdExpr is effectively a dual-mode getter/setter callback in this adapter, and the two-argument signature is expected.

* @public
*/
hasItemsExpr?: string | Function;
hasItemsExpr?: string | ((item: TRowData) => TKey);
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.

I am not sure if it should return TKey. TKey is a type of key, hasItemsExpr doesn't return a key, so its return type should be different.

Judging by the usage, the type should be this:

hasItemsExpr?: string | ((item: TRowData) => boolean);

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.

Please take a look at all other widget's d.ts files. I think they might have similar mistakes, e.g. here: https://github.com/DevExpress/DevExtreme/pull/33285/changes#diff-6698d8890476361148d70e40dd836b58e198b3e1f2932aaea589bb91d264102dR22

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.

Agree on the return type: hasItemsExpr should be boolean-like rather than TKey.
Also, I noticed this callback is used not only as a getter but also as a setter in the adapter here and here, so I added the second argument to the function signature as well.

hasItemsExpr?: string | ((item: TRowData, value?: boolean) => boolean | undefined);

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.

and about disabledExpr, agree, fixed returned type

* @public
*/
hasItemsExpr?: string | Function;
hasItemsExpr?: string | ((item: TItem) => TKey);
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.

I am not sure about treeView impl, but I suspect it should be similar to treeLists hasItemsExpr:
https://github.com/DevExpress/DevExtreme/pull/33285/changes#r3111399000

Please take a look

* @public
*/
expandedExpr?: string | Function;
expandedExpr?: string | ((item: TItem) => TKey);
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.

I suspect it should return boolean:

expandedExpr?: string | ((item: TItem) => boolean);

Can you check plz?

* @public
*/
parentIdExpr?: string | Function;
parentIdExpr?: string | ((item: TItem, value?: any) => TKey);
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.

Are you sure it accepts two parameters?

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.

Checked it again and removed additional argument

@dmlvr dmlvr dismissed stale reviews from EugeniyKiyashko and mpreyskurantov via 391e610 April 20, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants