Skip to content

Scheduler - Fix TypeScript error in appointment_popup.integration.test#33281

Merged
aleksei-semikozov merged 2 commits into
DevExpress:26_1from
aleksei-semikozov:fix-appointment-popup-integration-ts
Apr 16, 2026
Merged

Scheduler - Fix TypeScript error in appointment_popup.integration.test#33281
aleksei-semikozov merged 2 commits into
DevExpress:26_1from
aleksei-semikozov:fix-appointment-popup-integration-ts

Conversation

@aleksei-semikozov
Copy link
Copy Markdown
Contributor

No description provided.

@aleksei-semikozov aleksei-semikozov force-pushed the fix-appointment-popup-integration-ts branch from c0ad594 to 177d595 Compare April 15, 2026 11:02
@aleksei-semikozov aleksei-semikozov marked this pull request as ready for review April 15, 2026 14:10
@aleksei-semikozov aleksei-semikozov requested a review from a team as a code owner April 15, 2026 14:10
Copilot AI review requested due to automatic review settings April 15, 2026 14:10
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

Fixes a TypeScript compile error in the Scheduler appointment popup integration test by avoiding direct indexing into a possibly-undefined dxForm.option('items') result.

Changes:

  • Replaces a @ts-expect-error and direct option('items')[1] access with a null-safe retrieval of form items.
  • Keeps the recurrence group extraction logic working while satisfying TypeScript’s type checking.

Comment on lines +1634 to 1636
const recurrenceGroup = formItems[1] as GroupItem;
const allItems = flattenBy<SimpleItem>(
recurrenceGroup.items as SimpleItem[],
Copy link

Copilot AI Apr 15, 2026

Choose a reason for hiding this comment

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

formItems[1] as GroupItem still relies on a positional index and an unchecked cast. Since the recurrence group has a stable name (recurrenceGroup) in the form items, it would be more robust to locate it by name (e.g., via dxForm.itemOption('recurrenceGroup') or find(i => i.name === 'recurrenceGroup')) and add an explicit assertion if it isn’t found, so failures are clearer than a runtime Cannot read properties of undefined when accessing recurrenceGroup.items.

Suggested change
const recurrenceGroup = formItems[1] as GroupItem;
const allItems = flattenBy<SimpleItem>(
recurrenceGroup.items as SimpleItem[],
const recurrenceGroup = formItems.find(
(item): item is GroupItem => item.name === 'recurrenceGroup' && 'items' in item,
);
if (!recurrenceGroup) {
throw new Error('The recurrenceGroup item was not found in the appointment popup form items.');
}
const allItems = flattenBy<SimpleItem>(
(recurrenceGroup.items ?? []) as SimpleItem[],

Copilot uses AI. Check for mistakes.
@aleksei-semikozov aleksei-semikozov merged commit 38bc2ef into DevExpress:26_1 Apr 16, 2026
107 checks passed
@aleksei-semikozov aleksei-semikozov deleted the fix-appointment-popup-integration-ts branch April 16, 2026 18:21
sjbur pushed a commit to sjbur/DevExtreme that referenced this pull request May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants