Scheduler — Refactor scheduler.d.ts file#34269
Conversation
| menuItemTemplate: {}, | ||
| name: String as PropType<string | FormPredefinedButtonItem | SchedulerPredefinedToolbarItem>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any> | dxButtonGroupOptions>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any>>, |
There was a problem hiding this comment.
DateNavigatorItemProperties extends dxButtonGroupOptions, so no point of including dxButtonGroupOptions here
There was a problem hiding this comment.
Pull request overview
This PR refactors the Scheduler TypeScript declarations to align dxScheduler with the Properties-based typing pattern and to reuse canonical Properties/Item types from related widgets (ButtonGroup/Toolbar). It also updates the Vue Scheduler wrapper typings accordingly.
Changes:
- Updated
dxSchedulerto extendWidget<DevExpress.ui.dxScheduler.Properties>instead ofWidget<dxSchedulerOptions>. - Refactored Scheduler-related composite types (e.g.,
DateNavigatorItemProperties, toolbar item base types) to usedxButtonGroup.Properties/dxButtonGroup.ItemanddxToolbar.Item. - Updated the Vue wrapper Scheduler component prop typings (notably the
optionsprop unions).
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/devextreme/ts/dx.all.d.ts | Aligns dxScheduler generics and refactors Scheduler namespace types to use canonical ButtonGroup/Toolbar Properties/Item types. |
| packages/devextreme/js/ui/scheduler.d.ts | Refactors imports/types, adds explicit base-widget event overrides in dxSchedulerOptions, and switches the class generic to Properties. |
| packages/devextreme-vue/src/scheduler.ts | Updates Vue wrapper prop typings for Scheduler toolbar/date navigator options. |
Comments suppressed due to low confidence (2)
packages/devextreme-vue/src/scheduler.ts:126
packages/devextreme-vue/src/scheduler.tsis generated output (seepackages/devextreme-vue/project.jsontargetgenerate-components, which outputs{projectRoot}/src/**/*). Direct edits here are likely to be overwritten on regeneration; the change should be made in the Vue wrapper generator/metadata and thennx generate-components devextreme-vue(ornx run devextreme-vue:regenerate) should be run to updatesrc/.
import {
dxButtonGroupItem,
ContentReadyEvent as ButtonGroupContentReadyEvent,
DisposingEvent as ButtonGroupDisposingEvent,
InitializedEvent as ButtonGroupInitializedEvent,
packages/devextreme-vue/src/scheduler.ts:126
dxButtonGroupOptionswas removed from thedevextreme/ui/button_groupimports, but it is still needed ifoptionsprops accept values typed asdxButtonGroupOptions. Without it, the remaining union usesRecord<string, any>, and adxButtonGroupOptions-typed variable is not assignable toRecord<string, any>because it lacks an index signature (TypeScript will report an error).
import {
dxButtonGroupItem,
ContentReadyEvent as ButtonGroupContentReadyEvent,
DisposingEvent as ButtonGroupDisposingEvent,
InitializedEvent as ButtonGroupInitializedEvent,
| menuItemTemplate: {}, | ||
| name: String as PropType<string | FormPredefinedButtonItem | SchedulerPredefinedToolbarItem>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any> | dxButtonGroupOptions>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any>>, |
There was a problem hiding this comment.
Created a test script:
const options: dxButtonGroupOptions = {}
let accepted: DateNavigatorItemProperties | Record<string, any> = options;
accepted = options;
No type errors.
| menuItemTemplate: {}, | ||
| name: String as PropType<SchedulerPredefinedToolbarItem>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any> | dxButtonGroupOptions>, | ||
| options: Object as PropType<DateNavigatorItemProperties | Record<string, any>>, |
There was a problem hiding this comment.
Created a test script:
const options: dxButtonGroupOptions = {}
let accepted: DateNavigatorItemProperties | Record<string, any> = options;
accepted = options;
No type errors.
No description provided.