DataGrid - fix default types in d.ts#34170
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates DevExtreme widget TypeScript declarations to better match runtime “default option” values (primarily switching event handler defaults from null to undefined where options are not stored) and removes now-unnecessary @ts-expect-error suppressions in grid filtering code.
Changes:
- Align
dxDataGrid/dxTreeListevent handler option types with@default undefinedby adding| undefinedand updating the JSDoc defaults. - Fix
filterValue-related typings to allownulldefaults and remove TS suppressions where the runtime explicitly assignsnull. - Normalize draggable/sortable callback option types to reflect
nulldefaults and simplify default options initialization.
Reviewed changes
Copilot reviewed 4 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/ui/tree_list.d.ts | Updates many TreeList action option defaults/types (null → undefined where appropriate). |
| packages/devextreme/js/ui/data_grid.d.ts | Updates many DataGrid action option defaults/types (null → undefined where appropriate). |
| packages/devextreme/js/common/grids.d.ts | Fixes grid base option and editing option typings (null vs undefined, incl. filterValue). |
| packages/devextreme/js/ui/filter_builder.d.ts | Fixes value to allow null and aligns callback types with @default null; removes inappropriate @default undefined tags on field properties. |
| packages/devextreme/js/ui/sortable.d.ts | Aligns sortable callback option types with runtime null defaults. |
| packages/devextreme/js/ui/draggable.d.ts | Aligns draggable callback option types with runtime null defaults. |
| packages/devextreme/js/ui/card_view.d.ts | Adjusts CardView defaults/types (notably filterValue and header dragging callbacks). |
| packages/devextreme/js/__internal/m_draggable.ts | Cleans up TS suppressions in draggable default options initialization. |
| packages/devextreme/js/__internal/grids/grid_core/filter/m_filter_sync.ts | Removes TS suppressions after filterValue typing update; keeps runtime behavior (null clears filter). |
| packages/devextreme/js/__internal/grids/grid_core/filter/m_filter_panel.ts | Removes TS suppression for clearing filterValue to null. |
| packages/devextreme/js/__internal/grids/grid_core/data_controller/m_data_controller.ts | Replaces casted onDataErrorOccurred default with null directly. |
| falseText?: string; | ||
| /** | ||
| * @docid GridBaseColumn.filterOperations | ||
| * @default undefined |
There was a problem hiding this comment.
removed because this is a type of GridBaseColumn which is used in grid.columns[]. There are no default values for .option('column[i].filterOperations') in runtime
| return { | ||
| ...super._getDefaultOptions(), | ||
| // @ts-expect-error | ||
| onDragStart: null, |
There was a problem hiding this comment.
This is just a question to clarify:
Is this change intentional?
Wouldn't it be better to leave these options in the default options list with the value 'undefined' instead of 'null'? Mainly for ease of search and consistency with the existing options list.
Do we intentionally want to completely remove them from '_getDefaultOptions()'?
No description provided.