From 007fc32d16f5f0a178caf2fd6531d540e795bc2a Mon Sep 17 00:00:00 2001 From: Aliullov Vlad Date: Mon, 23 Nov 2026 23:39:38 +0100 Subject: [PATCH] enable check TS in angular demos. Fix TS in scheduler demos --- .github/workflows/visual-tests-demos.yml | 6 ++--- .../Adaptability/Angular/app/app.service.ts | 4 ++-- .../Agenda/Angular/app/app.service.ts | 6 ++--- .../Angular/app/app.component.ts | 5 +++-- .../Angular/app/app.service.ts | 2 +- .../Angular/app/app.service.ts | 4 ++-- .../BasicViews/Angular/app/app.service.ts | 2 +- .../Angular/app/app.component.ts | 22 +++++++++---------- .../CellTemplates/Angular/app/app.service.ts | 2 +- .../ContextMenu/Angular/app/app.component.ts | 10 ++++----- .../Angular/app/app.component.ts | 3 ++- .../Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.service.ts | 2 +- .../DragAndDrop/Angular/app/app.component.ts | 4 ++-- .../DragAndDrop/Angular/app/app.service.ts | 4 ++-- .../Editing/Angular/app/app.component.ts | 2 +- .../Editing/Angular/app/app.service.ts | 2 +- .../Angular/app/app.component.ts | 6 ++--- .../GroupByDate/Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.service.ts | 4 ++-- .../HiddenDays/Angular/app/app.service.ts | 2 +- .../Angular/app/app.service.ts | 6 ++--- .../Angular/app/app.component.ts | 3 ++- .../Angular/app/app.service.ts | 4 ++-- .../Overview/Angular/app/app.component.ts | 4 ++-- .../Overview/Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.component.ts | 2 +- .../Resources/Angular/app/app.service.ts | 8 +++---- .../SimpleArray/Angular/app/app.service.ts | 2 +- .../Templates/Angular/app/app.component.ts | 12 ++++++++-- .../Templates/Angular/app/app.service.ts | 4 ++-- .../Angular/app/app.component.ts | 4 ++-- .../Angular/app/app.service.ts | 4 ++-- .../Timelines/Angular/app/app.service.ts | 6 ++--- .../Toolbar/Angular/app/app.component.ts | 8 +++---- .../Toolbar/Angular/app/app.service.ts | 2 +- .../Angular/app/app.service.ts | 16 +++++++------- apps/demos/tsconfig.ngc-check.json | 6 ++--- 40 files changed, 107 insertions(+), 96 deletions(-) diff --git a/.github/workflows/visual-tests-demos.yml b/.github/workflows/visual-tests-demos.yml index 47907c30b3cb..b596a7a2cd8e 100644 --- a/.github/workflows/visual-tests-demos.yml +++ b/.github/workflows/visual-tests-demos.yml @@ -325,9 +325,9 @@ jobs: working-directory: apps/demos run: pnpm run ts-check-vue - # - name: Run check TS for Angular - # working-directory: apps/demos - # run: pnpm run ts-check-ng + - name: Run check TS for Angular + working-directory: apps/demos + run: pnpm run ts-check-ng - name: Demos - Check React TS id: ts_react diff --git a/apps/demos/Demos/Scheduler/Adaptability/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Adaptability/Angular/app/app.service.ts index 3ba65e543d90..b6bf66d18fe6 100644 --- a/apps/demos/Demos/Scheduler/Adaptability/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Adaptability/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; @@ -14,7 +14,7 @@ export class Appointment { priorityId?: number[]; } -export class Resource { +export interface Resource { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/Agenda/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Agenda/Angular/app/app.service.ts index afe1498a443a..7ef1fe8a50d5 100644 --- a/apps/demos/Demos/Scheduler/Agenda/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Agenda/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { id: number; text: string; @@ -18,7 +18,7 @@ export class Appointment { recurrenceRule?: string; } -export class Assignee { +export interface Assignee { text: string; id: number; @@ -26,7 +26,7 @@ export class Assignee { color: string; } -export class Priority { +export interface Priority { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.component.ts index bca9773f12c6..df59e864b800 100644 --- a/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.component.ts @@ -4,6 +4,7 @@ import { } from '@angular/core'; import { DxSchedulerModule, DxRadioGroupModule } from 'devextreme-angular'; import type { DxRadioGroupTypes } from 'devextreme-angular/ui/radio-group'; +import type { DxSchedulerTypes } from 'devextreme-angular/ui/scheduler'; import { Service } from './app.service'; if (!/localhost/.test(document.location.host)) { @@ -34,9 +35,9 @@ export class AppComponent { 'week', ]; - readonly allDayPanelMode = signal('allDay'); + readonly allDayPanelMode = signal('allDay'); - readonly allDayPanelModes = ['all', 'allDay', 'hidden']; + readonly allDayPanelModes: DxSchedulerTypes.AllDayPanelMode[] = ['all', 'allDay', 'hidden']; onChangeAllDayPanelMode(e: DxRadioGroupTypes.ValueChangedEvent) { this.allDayPanelMode.set(e.value); diff --git a/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.service.ts index abfa5bdff059..ce2db6709054 100644 --- a/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/AllDayPanelMode/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/AppointmentCountPerCell/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/AppointmentCountPerCell/Angular/app/app.service.ts index 5dc8c0a2fde2..9a503ff33641 100644 --- a/apps/demos/Demos/Scheduler/AppointmentCountPerCell/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/AppointmentCountPerCell/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; roomId: number; @@ -10,7 +10,7 @@ export class Appointment { endDate: Date; } -export class Resource { +export interface Resource { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/BasicViews/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/BasicViews/Angular/app/app.service.ts index 4b885191a4c3..b09fc2526c3e 100644 --- a/apps/demos/Demos/Scheduler/BasicViews/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/BasicViews/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.component.ts index 3f78ac685433..72d874a36a0e 100644 --- a/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.component.ts @@ -92,7 +92,7 @@ export class AppComponent { }; readonly onAppointmentFormOpening = (e: DxSchedulerTypes.AppointmentFormOpeningEvent) => { - const startDate = e.appointmentData.startDate as Date; + const startDate = e.appointmentData?.startDate as Date; if (!this.isValidAppointmentDate(startDate)) { e.cancel = true; this.notifyDisableDate(); @@ -147,10 +147,13 @@ export class AppComponent { }; private readonly isValidAppointment = (component: DxSchedulerComponent['instance'], appointmentData: DxSchedulerTypes.Appointment) => { - const startDate = new Date(appointmentData.startDate); - const endDate = new Date(appointmentData.endDate); - const cellDuration = component.option('cellDuration'); - return this.isValidAppointmentInterval(startDate, endDate, cellDuration); + const { startDate, endDate } = appointmentData; + if (!startDate || !endDate) { + return true; + } + + const cellDuration = component.option('cellDuration') ?? 30; + return this.isValidAppointmentInterval(new Date(startDate), new Date(endDate), cellDuration); }; private readonly isValidAppointmentInterval = (startDate: Date, endDate: Date, cellDuration: number) => { @@ -177,14 +180,11 @@ export class AppComponent { private readonly applyDisableDatesToDateEditors = (form: DxFormComponent['instance']) => { const holidays = this.dataService.getHolidays(); - const startDateEditor = form.getEditor('startDate'); - startDateEditor.option('disabledDates', holidays); - - const endDateEditor = form.getEditor('endDate'); - endDateEditor.option('disabledDates', holidays); + form.getEditor('startDate')?.option('disabledDates', holidays); + form.getEditor('endDate')?.option('disabledDates', holidays); }; - private setComponentAria(element): void { + private setComponentAria(element: ReturnType | undefined): void { const prevAria = element?.attr('aria-label') || ''; const description = this.ariaDescription(); const nextAria = `${prevAria}${description ? ` ${description}` : ''}`; diff --git a/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.service.ts index a62ced1aadf5..13e3f48e0e77 100644 --- a/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/CellTemplates/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Data { +export interface Data { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/ContextMenu/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/ContextMenu/Angular/app/app.component.ts index cee4d497cbb2..f15116a0ebf4 100644 --- a/apps/demos/Demos/Scheduler/ContextMenu/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/ContextMenu/Angular/app/app.component.ts @@ -9,7 +9,7 @@ import { } from 'devextreme-angular/ui/scheduler'; import { DxContextMenuModule, type DxContextMenuTypes } from 'devextreme-angular/ui/context-menu'; -import { Service, type Resource, type ContextMenuItem } from './app.service'; +import { Service, type ContextMenuItem } from './app.service'; if (!/localhost/.test(document.location.host)) { enableProdMode(); @@ -44,7 +44,7 @@ export class AppComponent { readonly contextMenuItems = signal([]); onContextMenuItemClick(e: DxContextMenuTypes.ItemClickEvent) { - e.itemData.onItemClick(e); + e.itemData?.onItemClick?.(e); } onAppointmentContextMenu(e: DxSchedulerTypes.AppointmentContextMenuEvent) { @@ -82,7 +82,7 @@ export class AppComponent { beginGroup: true, onItemClick: () => scheduler.updateAppointment(appointment, { ...appointment, - startDate: targetedAppointment.startDate, + startDate: targetedAppointment?.startDate, recurrenceRule: 'FREQ=WEEKLY', }), }, @@ -93,9 +93,9 @@ export class AppComponent { }, ...this.resourcesData.map((item) => ({ ...item, - onItemClick: ({ itemData }: DxContextMenuTypes.ItemClickEvent) => scheduler.updateAppointment(appointment, { + onItemClick: () => scheduler.updateAppointment(appointment, { ...appointment, - roomId: [itemData.id], + roomId: [item.id], }), })), ]; diff --git a/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.ts index f2f35f710345..3cb3db3dad36 100644 --- a/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.component.ts @@ -1,6 +1,7 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { Component, enableProdMode, inject } from '@angular/core'; import { DxSchedulerModule } from 'devextreme-angular'; +import type { DxSchedulerTypes } from 'devextreme-angular/ui/scheduler'; import { Service } from './app.service'; if (!/localhost/.test(document.location.host)) { @@ -24,7 +25,7 @@ export class AppComponent { readonly prioritiesData = this.service.getPriorities(); - onSelectionEnd(e) { + onSelectionEnd(e: DxSchedulerTypes.SelectionEndEvent) { const cells = e.selectedCellData; if (cells.length <= 1) { return; diff --git a/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.service.ts index 2e7065502a62..f56e5c083930 100644 --- a/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/CreateFromSelection/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; priorityId: number; @@ -10,7 +10,7 @@ export class Appointment { endDate: Date; } -export class Priority { +export interface Priority { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Angular/app/app.service.ts index 5fec2bbe0f86..d3c163144026 100644 --- a/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/CurrentTimeIndicator/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { startDate: Date; endDate: Date; @@ -10,7 +10,7 @@ export class Appointment { recurrenceRule?: string; } -export class MovieData { +export interface MovieData { id: number; text: string; diff --git a/apps/demos/Demos/Scheduler/CustomViewDuration/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/CustomViewDuration/Angular/app/app.service.ts index 0689c5ac9750..e9203cb397fc 100644 --- a/apps/demos/Demos/Scheduler/CustomViewDuration/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/CustomViewDuration/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.component.ts index 04241d2abda9..b09f4cb4fa0e 100644 --- a/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.component.ts @@ -33,14 +33,14 @@ export class AppComponent { readonly currentDate = new Date(2021, 3, 26); - onAppointmentRemove = (e: DxSchedulerTypes.AppointmentDraggingRemoveEvent) => { + onAppointmentRemove = (e: Pick) => { if (this.appointments().includes(e.itemData)) { this.appointments.update((items) => items.filter((item) => item !== e.itemData)); this.tasks.update((items) => [...items, e.itemData]); } }; - onAppointmentAdd = (e: DxSchedulerTypes.AppointmentDraggingAddEvent) => { + onAppointmentAdd = (e: Pick) => { if (this.tasks().includes(e.fromData)) { this.tasks.update((items) => items.filter((item) => item !== e.fromData)); this.appointments.update((items) => [...items, e.itemData]); diff --git a/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.service.ts index 78f7da830cb1..0da08ca9850c 100644 --- a/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/DragAndDrop/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; @@ -10,7 +10,7 @@ export class Appointment { allDay?: boolean; } -export class Task { +export interface Task { text: string; } diff --git a/apps/demos/Demos/Scheduler/Editing/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/Editing/Angular/app/app.component.ts index 3a09b1f6f206..55c89682d929 100644 --- a/apps/demos/Demos/Scheduler/Editing/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/Editing/Angular/app/app.component.ts @@ -25,7 +25,7 @@ export class AppComponent { readonly currentDate = new Date(2021, 3, 29); - private showToast(event: string, value: string, type: string) { + private showToast(event: string, value: string | undefined, type: string) { notify(`${event} "${value}" task`, type, 800); } diff --git a/apps/demos/Demos/Scheduler/Editing/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Editing/Angular/app/app.service.ts index 4b885191a4c3..b09fc2526c3e 100644 --- a/apps/demos/Demos/Scheduler/Editing/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Editing/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/GoogleCalendarIntegration/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/GoogleCalendarIntegration/Angular/app/app.component.ts index eead21ece18d..dd8e0a5981f4 100644 --- a/apps/demos/Demos/Scheduler/GoogleCalendarIntegration/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/GoogleCalendarIntegration/Angular/app/app.component.ts @@ -28,7 +28,7 @@ export class AppComponent { readonly currentDate = new Date(2017, 4, 25); - private getData(requestOptions: Record) { + private getData(params: Record) { const PUBLIC_KEY = 'AIzaSyBnNAISIUKe6xdhq1_rjor2rxoI3UlMY7k'; const CALENDAR_ID = 'f7jnetm22dsjc3npc2lu3buvu4@group.calendar.google.com'; const dataUrl = [ @@ -38,8 +38,8 @@ export class AppComponent { PUBLIC_KEY, ].join(''); - return lastValueFrom(this.http.get(dataUrl, requestOptions)) - .then(({ items }: Record) => items); + return lastValueFrom(this.http.get<{ items: unknown[] }>(dataUrl, { params })) + .then(({ items }) => items); } } diff --git a/apps/demos/Demos/Scheduler/GroupByDate/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/GroupByDate/Angular/app/app.service.ts index 8a48b1273f59..5509816598d9 100644 --- a/apps/demos/Demos/Scheduler/GroupByDate/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/GroupByDate/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; priorityId: number; @@ -12,7 +12,7 @@ export class Appointment { recurrenceRule?: string; } -export class Priority { +export interface Priority { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/GroupingByResources/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/GroupingByResources/Angular/app/app.service.ts index 285a509ef344..84b95d69663b 100644 --- a/apps/demos/Demos/Scheduler/GroupingByResources/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/GroupingByResources/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; priorityId: number; @@ -10,7 +10,7 @@ export class Appointment { endDate: Date; } -export class Priority { +export interface Priority { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/HiddenDays/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/HiddenDays/Angular/app/app.service.ts index b1f6e319614e..34f46b5cceb2 100644 --- a/apps/demos/Demos/Scheduler/HiddenDays/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/HiddenDays/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { id: number; text: string; diff --git a/apps/demos/Demos/Scheduler/IndividualViewsCustomization/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/IndividualViewsCustomization/Angular/app/app.service.ts index 8862ac888503..cbef3de9f7af 100644 --- a/apps/demos/Demos/Scheduler/IndividualViewsCustomization/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/IndividualViewsCustomization/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Data { +export interface Data { text: string; priorityId: number; @@ -14,7 +14,7 @@ export class Data { recurrenceRule?: string; } -export class PriorityData { +export interface PriorityData { text: string; id: number; @@ -22,7 +22,7 @@ export class PriorityData { color: string; } -export class TypeData { +export interface TypeData { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.component.ts index a0028c7fcb0c..aca6dab1cc3d 100644 --- a/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.component.ts @@ -2,6 +2,7 @@ import { bootstrapApplication } from '@angular/platform-browser'; import { Component, enableProdMode, inject } from '@angular/core'; import { DxSchedulerModule } from 'devextreme-angular'; import type { DxSchedulerTypes } from 'devextreme-angular/ui/scheduler'; +import type { DxSelectBoxTypes } from 'devextreme-angular/ui/select-box'; import { type Assignee, Service } from './app.service'; type Form = DxSchedulerTypes.AppointmentFormOpeningEvent['form']; @@ -94,7 +95,7 @@ export class AppComponent { value: roomId, placeholder: 'Room', stylingMode: form.getEditor('assigneeId')?.option('stylingMode'), - onValueChanged: (e) => { + onValueChanged: (e: DxSelectBoxTypes.ValueChangedEvent) => { const editor = form.getEditor('assigneeId'); editor?.option('dataSource', e.value ? this.employeesOf(e.value) : []); diff --git a/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.service.ts index eda9a2100084..b57a099f1315 100644 --- a/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/MultilevelGrouping/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; assigneeId: number[]; @@ -10,7 +10,7 @@ export class Appointment { endDate: Date; } -export class Assignee { +export interface Assignee { id: number | string; text: string; diff --git a/apps/demos/Demos/Scheduler/Overview/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/Overview/Angular/app/app.component.ts index 14343a120594..206918e4402f 100644 --- a/apps/demos/Demos/Scheduler/Overview/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/Overview/Angular/app/app.component.ts @@ -43,14 +43,14 @@ export class AppComponent { const day = date.getDay(); return day === 0 || day === 6; } - const classObject = {}; + const classObject: Record = {}; classObject[`employee-${cellData.groups.employeeID}`] = true; classObject[`employee-weekend-${cellData.groups.employeeID}`] = isWeekEnd(cellData.startDate); return classObject; }; readonly markTraining = (cellData: Data & { groups: Data }) => { - const classObject = { + const classObject: Record = { 'day-cell': true, }; diff --git a/apps/demos/Demos/Scheduler/Overview/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Overview/Angular/app/app.service.ts index 3bbcd2c40b26..5c580059fae6 100644 --- a/apps/demos/Demos/Scheduler/Overview/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Overview/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Employee { +export interface Employee { text: string; id: number; @@ -14,7 +14,7 @@ export class Employee { discipline: string; } -export class Data { +export interface Data { text: string; employeeID: number; diff --git a/apps/demos/Demos/Scheduler/RecurringAppointments/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/RecurringAppointments/Angular/app/app.service.ts index f464d39838ba..2d1e2a18ef00 100644 --- a/apps/demos/Demos/Scheduler/RecurringAppointments/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/RecurringAppointments/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; roomId: number[]; @@ -14,7 +14,7 @@ export class Appointment { recurrenceException?: string; } -export class Resource { +export interface Resource { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.ts index 98613ba122d9..d980f67dcc0e 100644 --- a/apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/ResolveTimeConflicts/Angular/app/app.component.ts @@ -86,7 +86,7 @@ export class AppComponent { readonly customizeItem = (item: DxFormTypes.SimpleItem): void => { if (item.name === 'allDayEditor' || item.name === 'recurrenceEndEditor') { - item.label.visible = true; + item.label = { ...item.label, visible: true }; } else if (item.name === 'subjectEditor') { item.editorOptions = item.editorOptions || {}; item.editorOptions.placeholder = 'Add title'; diff --git a/apps/demos/Demos/Scheduler/Resources/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Resources/Angular/app/app.service.ts index b6d77b667ca2..6b9a1971daa8 100644 --- a/apps/demos/Demos/Scheduler/Resources/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Resources/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; @@ -16,7 +16,7 @@ export class Appointment { priorityId: number; } -export class Assignee { +export interface Assignee { text: string; id: number; @@ -24,7 +24,7 @@ export class Assignee { color: string; } -export class Room { +export interface Room { text: string; id: number; @@ -32,7 +32,7 @@ export class Room { color: string; } -export class Priority { +export interface Priority { text: string; id: number; diff --git a/apps/demos/Demos/Scheduler/SimpleArray/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/SimpleArray/Angular/app/app.service.ts index a2b2545bcaf8..47dc1d0c8688 100644 --- a/apps/demos/Demos/Scheduler/SimpleArray/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/SimpleArray/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; diff --git a/apps/demos/Demos/Scheduler/Templates/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/Templates/Angular/app/app.component.ts index 1613d6d43987..98fc9a4ddfc1 100644 --- a/apps/demos/Demos/Scheduler/Templates/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/Templates/Angular/app/app.component.ts @@ -73,7 +73,7 @@ export class AppComponent { private readonly onPopupOptionChanged = (e: DxPopupTypes.OptionChangedEvent): void => { if (e.fullName === 'toolbarItems' && e.value) { - e.value.forEach((item, index) => { + e.value.forEach((item: DxPopupTypes.ToolbarItem & { shortcut?: string }, index: number) => { if (item.shortcut === 'done' || item.shortcut === 'cancel') { e.component.option(`toolbarItems[${index}].toolbar`, 'bottom'); } @@ -88,6 +88,10 @@ export class AppComponent { private readonly updateEndDate = (movie: MovieData): void => { const form = this.formInstance; + if (!form) { + return; + } + const formData = form.option('formData'); const { startDate } = formData; @@ -99,6 +103,10 @@ export class AppComponent { readonly onFormInitialized = (e: DxFormTypes.InitializedEvent): void => { const form = e.component; + if (!form) { + return; + } + const formData = form.option('formData'); this.formInstance = form; @@ -122,7 +130,7 @@ export class AppComponent { this.currentSelectedMovie.set(movie); if (movie) { - form.updateData('director', movie.director); + form?.updateData('director', movie.director); this.updateEndDate(movie); } }; diff --git a/apps/demos/Demos/Scheduler/Templates/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Templates/Angular/app/app.service.ts index f82dcce38898..d1c0a04265ff 100644 --- a/apps/demos/Demos/Scheduler/Templates/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Templates/Angular/app/app.service.ts @@ -16,13 +16,13 @@ export interface MovieData { color: string; } -export class TheatreData { +export interface TheatreData { text: string; id: number; } -export class Data { +export interface Data { theatreId: number; movieId: number; diff --git a/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.component.ts index 16dfeb4c91f6..6d3486b3c40a 100644 --- a/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.component.ts @@ -39,8 +39,8 @@ export class AppComponent { } onAppointmentFormOpening({ form }: DxSchedulerTypes.AppointmentFormOpeningEvent) { - const startDateDataSource = form.getEditor('startDateTimeZone').option('dataSource') as DataSource; - const endDateDataSource = form.getEditor('endDateTimeZone').option('dataSource') as DataSource; + const startDateDataSource = form.getEditor('startDateTimeZone')?.option('dataSource') as DataSource; + const endDateDataSource = form.getEditor('endDateTimeZone')?.option('dataSource') as DataSource; startDateDataSource.filter(['id', 'contains', 'Europe']); endDateDataSource.filter(['id', 'contains', 'Europe']); diff --git a/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.service.ts index 51a8f06dc078..143810ad170b 100644 --- a/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/TimeZonesSupport/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Data { +export interface Data { text: string; startDate: string; @@ -10,7 +10,7 @@ export class Data { recurrenceRule?: string; } -export class Location { +export interface Location { id: string; offset: number; diff --git a/apps/demos/Demos/Scheduler/Timelines/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Timelines/Angular/app/app.service.ts index 588492803f06..b4b68c7cc106 100644 --- a/apps/demos/Demos/Scheduler/Timelines/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Timelines/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Priority { +export interface Priority { text: string; id: number; @@ -8,7 +8,7 @@ export class Priority { color: string; } -export class Resource { +export interface Resource { text: string; id: number; @@ -16,7 +16,7 @@ export class Resource { color: string; } -export class Appointment { +export interface Appointment { text: string; ownerId: number[]; diff --git a/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.component.ts b/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.component.ts index f22e865f88e4..d69504bd5d31 100644 --- a/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.component.ts +++ b/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.component.ts @@ -59,10 +59,10 @@ export class AppComponent { return; } - const currentDate = this.scheduler().instance.option('currentDate'); - const cellDuration = this.scheduler().instance.option('cellDuration'); + const currentDate = this.scheduler().instance.option('currentDate') ?? new Date(); + const cellDuration = this.scheduler().instance.option('cellDuration') ?? 30; const cellDurationMs = cellDuration * MS_IN_HOUR; - const currentTime = new Date(currentDate as Date).getTime(); + const currentTime = new Date(currentDate).getTime(); const roundTime = Math.round(currentTime / cellDurationMs) * cellDurationMs; this.scheduler().instance.showAppointmentPopup({ @@ -72,7 +72,7 @@ export class AppComponent { } onAssigneesChange(event: DxSelectBoxTypes.ValueChangedEvent) { - const dataSource = this.scheduler().instance.option('dataSource'); + const { dataSource } = this; const filter = event.value ? ['assigneeId', 'contains', event.value] : null; dataSource.filter(filter); diff --git a/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.service.ts index 4e37daeebf82..54c4abd874aa 100644 --- a/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/Toolbar/Angular/app/app.service.ts @@ -15,7 +15,7 @@ export interface Assignee { text: string; } -const addDays = (date, days) => new Date(new Date(date).setUTCDate(date.getUTCDate() + days)); +const addDays = (date: Date, days: number) => new Date(new Date(date).setUTCDate(date.getUTCDate() + days)); const now = new Date(new Date().setUTCHours(0, 0, 0, 0)); const startOfTheWeek = addDays(now, -now.getUTCDay()); const currentDate = new Date(2025, 5, 10); diff --git a/apps/demos/Demos/Scheduler/VirtualScrolling/Angular/app/app.service.ts b/apps/demos/Demos/Scheduler/VirtualScrolling/Angular/app/app.service.ts index 6fe1860ccff4..58103ef0f9eb 100644 --- a/apps/demos/Demos/Scheduler/VirtualScrolling/Angular/app/app.service.ts +++ b/apps/demos/Demos/Scheduler/VirtualScrolling/Angular/app/app.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; -export class Appointment { +export interface Appointment { text: string; startDate: Date; @@ -10,7 +10,7 @@ export class Appointment { humanId: number; } -export class Resource { +export interface Resource { id: number; text: string; @@ -206,18 +206,18 @@ export class Service { get appointmentsText() { return appointmentsText; } - getRandomDuration(durationState): number { + getRandomDuration(durationState: number): number { const durationMin = Math.floor((durationState % 23) / 3 + 5) * 15; return durationMin * 60 * 1000; } - getRandomText(textIndex): string { + getRandomText(textIndex: number): string { return appointmentsText[textIndex % appointmentsText.length]; } - filterAppointmentsByTime(appointments, startDayHour, endDayHour): Appointment[] { - const result = []; + filterAppointmentsByTime(appointments: Appointment[], startDayHour: number, endDayHour: number): Appointment[] { + const result: Appointment[] = []; for (let i = 0; i < appointments.length; i += 1) { const startDate = appointments[i].startDate; @@ -233,8 +233,8 @@ export class Service { return result; } - generateAppointments(startDay, endDay, startDayHour, endDayHour): Appointment[] { - const appointments = []; + generateAppointments(startDay: Date, endDay: Date, startDayHour: number, endDayHour: number): Appointment[] { + const appointments: Appointment[] = []; let textIndex = 0; let durationState = 1; diff --git a/apps/demos/tsconfig.ngc-check.json b/apps/demos/tsconfig.ngc-check.json index 3a691b58182d..ff1240a3f33e 100644 --- a/apps/demos/tsconfig.ngc-check.json +++ b/apps/demos/tsconfig.ngc-check.json @@ -2,10 +2,10 @@ "compilerOptions": { "skipLibCheck": true, "skipDefaultLibCheck": true, - "strict": false, + "strict": true, "verbatimModuleSyntax": true, "module": "ESNext", - "moduleResolution": "Node", + "moduleResolution": "bundler", "ignoreDeprecations": "6.0", "lib": ["es2022", "DOM", "DOM.Iterable"], "resolveJsonModule": true @@ -16,7 +16,7 @@ }, "include": [ - "Demos/**/Angular/**/*.ts", + "Demos/Scheduler/**/Angular/**/*.ts", "shared/anti-forgery/index.d.ts" ] }