diff --git a/package-lock.json b/package-lock.json
index c81abf023b62..72ddf4bb83ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -34,7 +34,7 @@
"@taiga-ui/event-plugins": "4.0.1",
"@taiga-ui/prettier-config": "0.113.3",
"@taiga-ui/stylelint-config": "0.147.0",
- "@taiga-ui/tsconfig": "0.113.3",
+ "@taiga-ui/tsconfig": "0.147.10",
"@types/glob": "8.1.0",
"@types/loader-utils": "2.0.6",
"@types/node": "22.5.1",
@@ -9765,9 +9765,9 @@
"link": true
},
"node_modules/@taiga-ui/tsconfig": {
- "version": "0.113.3",
- "resolved": "https://registry.npmjs.org/@taiga-ui/tsconfig/-/tsconfig-0.113.3.tgz",
- "integrity": "sha512-XYQ5VU3Dt4crnI7OZ/BwwMVl7S6c3YUt2+vDWkWv/VLc2yoUu85lEnsl3J5mqasnamENUiSbXWSGxh3h0m2WEA==",
+ "version": "0.147.10",
+ "resolved": "https://registry.npmjs.org/@taiga-ui/tsconfig/-/tsconfig-0.147.10.tgz",
+ "integrity": "sha512-LaNRtPZIwUEPifUwVa4D6H52KJgbEzcb8CeKXvz2hh69ng1GsgrMSQkGm+GtKfuQmlONR8N62R0sIKx0J+jtKQ==",
"dev": true,
"license": "Apache-2.0"
},
diff --git a/package.json b/package.json
index d3c2e3bfd7e2..eb8a79284e8e 100644
--- a/package.json
+++ b/package.json
@@ -130,7 +130,7 @@
"@taiga-ui/event-plugins": "4.0.1",
"@taiga-ui/prettier-config": "0.113.3",
"@taiga-ui/stylelint-config": "0.147.0",
- "@taiga-ui/tsconfig": "0.113.3",
+ "@taiga-ui/tsconfig": "0.147.10",
"@types/glob": "8.1.0",
"@types/loader-utils": "2.0.6",
"@types/node": "22.5.1",
diff --git a/projects/addon-charts/components/line-chart/line-chart.component.ts b/projects/addon-charts/components/line-chart/line-chart.component.ts
index ace10d3b05f4..a642df97f669 100644
--- a/projects/addon-charts/components/line-chart/line-chart.component.ts
+++ b/projects/addon-charts/components/line-chart/line-chart.component.ts
@@ -48,9 +48,7 @@ export class TuiLineChart {
private readonly hover$ = new Subject();
private readonly autoId = tuiInjectId();
- protected readonly hintDirective = inject(TuiLineChartHint, {
- optional: true,
- });
+ protected readonly hintDirective = inject(TuiLineChartHint, {optional: true});
protected readonly hintOptions = inject(TuiHintOptionsDirective, {optional: true});
@@ -165,8 +163,10 @@ export class TuiLineChart {
protected getImplicit($implicit: TuiPoint): TuiPoint | readonly TuiPoint[] {
return (
- this.hintDirective?.getContext(this.value.indexOf($implicit), this) ||
- $implicit
+ (this.hintDirective?.getContext(
+ this.value.indexOf($implicit),
+ this,
+ ) as readonly TuiPoint[]) ?? $implicit
);
}
diff --git a/projects/addon-charts/components/line-days-chart/line-days-chart.component.ts b/projects/addon-charts/components/line-days-chart/line-days-chart.component.ts
index 688f11bc0206..ae28ee086ee2 100644
--- a/projects/addon-charts/components/line-days-chart/line-days-chart.component.ts
+++ b/projects/addon-charts/components/line-days-chart/line-days-chart.component.ts
@@ -1,5 +1,5 @@
import {NgForOf} from '@angular/common';
-import type {AfterViewInit, QueryList} from '@angular/core';
+import {type AfterViewInit, type QueryList} from '@angular/core';
import {
ChangeDetectionStrategy,
Component,
@@ -113,6 +113,12 @@ export class TuiLineDaysChart implements AfterViewInit {
});
}
+ public get hint():
+ | PolymorpheusContent>
+ | PolymorpheusContent> {
+ return this.hintDirective?.hint ?? this.hintContent;
+ }
+
public ngAfterViewInit(): void {
combineLatest([tuiLineChartDrivers(this.charts), this.hovered$])
.pipe(
@@ -146,6 +152,30 @@ export class TuiLineDaysChart implements AfterViewInit {
});
}
+ public raise(index: number, {value}: TuiLineChart): void {
+ const x = value[index]?.[0] || 0;
+ const month = this.getDay(x);
+
+ if (!month) {
+ return;
+ }
+
+ if (this.hintDirective) {
+ this.hintDirective.raise(month);
+ } else {
+ this.onHovered(month);
+ }
+ }
+
+ public getContext(index: number, {value}: TuiLineChart): unknown {
+ const x = value[index]?.[0] || 0;
+ const day = this.getDay(x);
+
+ return this.hintDirective && day
+ ? this.hintDirective.getContext(day)
+ : this.getHintContext(x, this.value);
+ }
+
protected get months(): ReadonlyArray {
return this.value.length ? this.breakMonths(this.value) : EMPTY_ARRAY;
}
@@ -154,18 +184,12 @@ export class TuiLineDaysChart implements AfterViewInit {
return this.months.length * (this.value[0]?.[0].daysCount || 0);
}
- protected get hint():
- | PolymorpheusContent>
- | PolymorpheusContent> {
- return this.hintDirective?.hint ?? this.hintContent;
- }
-
@tuiPure
protected getHintContext(
x: number,
value: ReadonlyArray<[TuiDay, number]>,
- ): [TuiDay, number] {
- return value[x - (value[0]?.[0]?.day || 0) + 1];
+ ): [TuiDay, number] | null {
+ return value[x - (value[0]?.[0]?.day || 0) + 1] ?? null;
}
protected readonly daysStringify: TuiStringHandler = (index) => {
@@ -183,34 +207,10 @@ export class TuiLineDaysChart implements AfterViewInit {
return index - offset;
}
- protected raise(index: number, {value}: TuiLineChart): void {
- const x = value[index]?.[0] || 0;
- const month = this.getDay(x);
-
- if (!month) {
- return;
- }
-
- if (this.hintDirective) {
- this.hintDirective.raise(month);
- } else {
- this.onHovered(month);
- }
- }
-
protected getWidth(index: number): number {
return (this.getDay(index)?.daysCount || 0) * this.months.length;
}
- protected getContext(index: number, {value}: TuiLineChart): unknown {
- const x = value[index]?.[0] || 0;
- const day = this.getDay(x);
-
- return this.hintDirective && day
- ? this.hintDirective.getContext(day)
- : this.getHintContext(x, this.value);
- }
-
@tuiPure
private breakMonths(
value: ReadonlyArray<[TuiDay, number]>,
diff --git a/projects/addon-charts/components/line-days-chart/line-days-chart.template.html b/projects/addon-charts/components/line-days-chart/line-days-chart.template.html
index 0d981259f6dc..0010f61862dc 100644
--- a/projects/addon-charts/components/line-days-chart/line-days-chart.template.html
+++ b/projects/addon-charts/components/line-days-chart/line-days-chart.template.html
@@ -7,8 +7,8 @@
[style.zIndex]="zIndex"
[tuiHintContent]="hintContent ? hint : ''"
[value]="month"
- [width]="first ? firstWidth : getWidth(month[0][0])"
- [x]="first ? 0 : getX(month[0][0])"
+ [width]="first ? firstWidth : getWidth(month[0]?.[0] ?? 0)"
+ [x]="first ? 0 : getX(month[0]?.[0] ?? 0)"
[xStringify]="xStringify ? daysStringify : null"
[y]="y"
[yStringify]="yStringify"
diff --git a/projects/addon-charts/components/pie-chart/pie-chart.template.html b/projects/addon-charts/components/pie-chart/pie-chart.template.html
index be29eecbd2d3..9e4c9c6682ab 100644
--- a/projects/addon-charts/components/pie-chart/pie-chart.template.html
+++ b/projects/addon-charts/components/pie-chart/pie-chart.template.html
@@ -40,7 +40,7 @@
[style.color]="'var(--tui-chart-categorical-0' + index + ')'"
[tuiHint]="hintContent"
[tuiHintContext]="{$implicit: index}"
- [tuiPieChart]="segments[index]"
+ [tuiPieChart]="segments[index] || [0, 0]"
(tuiHoveredChange)="onHovered($event, index)"
/>
diff --git a/projects/cdk/directives/repeat-times/test/repeat-times.directive.spec.ts b/projects/cdk/directives/repeat-times/test/repeat-times.directive.spec.ts
index a833f8f8d97d..b60a6b7d5582 100644
--- a/projects/cdk/directives/repeat-times/test/repeat-times.directive.spec.ts
+++ b/projects/cdk/directives/repeat-times/test/repeat-times.directive.spec.ts
@@ -82,9 +82,9 @@ describe('TuiRepeatTimes directive', () => {
});
it('passes index as implicit context', () => {
- expect(debugElements[0].nativeElement.title).toBe('0');
- expect(debugElements[1].nativeElement.title).toBe('1');
- expect(debugElements[2].nativeElement.title).toBe('2');
+ expect(debugElements[0]?.nativeElement.title).toBe('0');
+ expect(debugElements[1]?.nativeElement.title).toBe('1');
+ expect(debugElements[2]?.nativeElement.title).toBe('2');
});
});
});
diff --git a/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts b/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts
index 5d2f4d3490e3..cfc096149674 100644
--- a/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts
+++ b/projects/cdk/utils/dom/test/get-element-obscurers.spec.ts
@@ -105,9 +105,9 @@ describe('tuiGetElementObscures', () => {
const mockElementFromPoint = jest.mocked(ownerDocument.elementFromPoint);
mockElementFromPoint
- .mockReturnValueOnce(others[0])
- .mockReturnValueOnce(others[1])
- .mockReturnValueOnce(others[2])
+ .mockReturnValueOnce(others[0]!)
+ .mockReturnValueOnce(others[1]!)
+ .mockReturnValueOnce(others[2]!)
.mockReturnValueOnce(element);
expect(tuiGetElementObscures(element)).toBeNull();
diff --git a/projects/core/components/calendar/test/calendar-sheet.component.spec.ts b/projects/core/components/calendar/test/calendar-sheet.component.spec.ts
index 7d7faeaf2948..94b8a57c4d0a 100644
--- a/projects/core/components/calendar/test/calendar-sheet.component.spec.ts
+++ b/projects/core/components/calendar/test/calendar-sheet.component.spec.ts
@@ -103,12 +103,12 @@ describe('CalendarSheet', () => {
it('blocked date under condition', () => {
expect(getDisabledCalendarItems().length).toBe(1);
expect(
- getDisabledCalendarItems()[0].nativeElement.textContent.trim(),
+ getDisabledCalendarItems()[0]?.nativeElement.textContent.trim(),
).toBe('20');
});
it('click on blocked date does not change value', () => {
- getDisabledCalendarItems()[0].nativeElement.click();
+ getDisabledCalendarItems()[0]?.nativeElement.click();
fixture.detectChanges();
expect(testComponent.value).toBeNull();
diff --git a/projects/demo-playwright/tests/deep/deep-select.spec.ts b/projects/demo-playwright/tests/deep/deep-select.spec.ts
index 84b7e8c0d21e..7be8bdf53b2e 100644
--- a/projects/demo-playwright/tests/deep/deep-select.spec.ts
+++ b/projects/demo-playwright/tests/deep/deep-select.spec.ts
@@ -57,7 +57,7 @@ test.describe('Deep / Select', () => {
if (cleaner) {
await cleaner.click();
} else {
- await options[0].focus();
+ await options[0]?.focus();
await page.keyboard.down('Enter');
}
diff --git a/projects/demo-playwright/tests/kit/slider/slider.spec.ts b/projects/demo-playwright/tests/kit/slider/slider.spec.ts
index f1f876dae8cf..bc15472cbd8c 100644
--- a/projects/demo-playwright/tests/kit/slider/slider.spec.ts
+++ b/projects/demo-playwright/tests/kit/slider/slider.spec.ts
@@ -162,7 +162,7 @@ test.describe('Slider', () => {
});
test('=> 0', async () => {
- await tickLabels[0].click();
+ await tickLabels[0]?.click();
await expect(async () => {
expect(await slider.value).toBe(0);
@@ -173,7 +173,7 @@ test.describe('Slider', () => {
});
test('=> 500', async () => {
- await tickLabels[2].click();
+ await tickLabels[2]?.click();
await expect(async () => {
expect(await slider.value).toBe(500);
@@ -184,7 +184,7 @@ test.describe('Slider', () => {
});
test('=> 750', async () => {
- await tickLabels[3].click();
+ await tickLabels[3]?.click();
await expect(async () => {
expect(await slider.value).toBe(750);
@@ -195,7 +195,7 @@ test.describe('Slider', () => {
});
test('=> 1000', async () => {
- await tickLabels.at(-1)!.click();
+ await tickLabels.at(-1)?.click();
await expect(async () => {
expect(await slider.value).toBe(1000);
diff --git a/projects/demo-playwright/utils/page-objects/calendar-range.po.ts b/projects/demo-playwright/utils/page-objects/calendar-range.po.ts
index 2880d0e8642d..ed0fbe636942 100644
--- a/projects/demo-playwright/utils/page-objects/calendar-range.po.ts
+++ b/projects/demo-playwright/utils/page-objects/calendar-range.po.ts
@@ -14,14 +14,14 @@ export class TuiCalendarRangePO {
public async selectItem(index: number): Promise {
const items = await this.getItems();
- await items[index].click();
+ await items[index]?.click();
}
public async itemHasCheckmark(index: number): Promise {
const items = await this.getItems();
const itemCheckmark = await items[index]
- .locator('[automation-id="tui-calendar-range__checkmark"]')
+ ?.locator('[automation-id="tui-calendar-range__checkmark"]')
.count();
return !!itemCheckmark;
diff --git a/projects/demo-playwright/utils/page-objects/input-date-range.po.ts b/projects/demo-playwright/utils/page-objects/input-date-range.po.ts
index bb724c0aceee..3ec9104de43e 100644
--- a/projects/demo-playwright/utils/page-objects/input-date-range.po.ts
+++ b/projects/demo-playwright/utils/page-objects/input-date-range.po.ts
@@ -26,14 +26,14 @@ export class TuiInputDateRangePO {
public async selectItem(index: number): Promise {
const items = await this.getItems();
- await items[index].click();
+ await items[index]?.click();
}
public async itemHasCheckmark(index: number): Promise {
const items = await this.getItems();
const itemCheckmark = await items[index]
- .locator('[automation-id="tui-calendar-range__checkmark"]')
+ ?.locator('[automation-id="tui-calendar-range__checkmark"]')
.count();
return !!itemCheckmark;
diff --git a/projects/demo-playwright/utils/page-objects/textfield-with-data-list.po.ts b/projects/demo-playwright/utils/page-objects/textfield-with-data-list.po.ts
index 031fd1ebb81e..c91b61085168 100644
--- a/projects/demo-playwright/utils/page-objects/textfield-with-data-list.po.ts
+++ b/projects/demo-playwright/utils/page-objects/textfield-with-data-list.po.ts
@@ -17,7 +17,7 @@ export class TuiTextfieldWithDataListPO {
const options = await this.getOptions();
for (const optionIndex of indexes) {
- await options[optionIndex].click();
+ await options[optionIndex]?.click();
}
}
diff --git a/projects/demo/src/modules/app/app.config.ts b/projects/demo/src/modules/app/app.config.ts
index 32b22763230a..c654cbcf1966 100644
--- a/projects/demo/src/modules/app/app.config.ts
+++ b/projects/demo/src/modules/app/app.config.ts
@@ -104,7 +104,7 @@ export const config: ApplicationConfig = {
}
return `${link}/${pkg.toLowerCase()}/${type.toLowerCase()}/${(
- header[0].toLowerCase() + header.slice(1)
+ (header[0]?.toLowerCase() ?? '') + header.slice(1)
).replaceAll(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`;
},
},
diff --git a/projects/demo/src/modules/app/landing/index.html b/projects/demo/src/modules/app/landing/index.html
index d8f00a257cad..c4e26437b90b 100644
--- a/projects/demo/src/modules/app/landing/index.html
+++ b/projects/demo/src/modules/app/landing/index.html
@@ -21,7 +21,7 @@
diff --git a/projects/demo/src/modules/components/axes/examples/2/index.ts b/projects/demo/src/modules/components/axes/examples/2/index.ts
index d936cb20ba3f..63bc864db2f9 100644
--- a/projects/demo/src/modules/components/axes/examples/2/index.ts
+++ b/projects/demo/src/modules/components/axes/examples/2/index.ts
@@ -51,7 +51,7 @@ export default class Example {
}
protected getSetName(index: number): string {
- return this.setNames[index];
+ return this.setNames[index] ?? '';
}
@tuiPure
diff --git a/projects/demo/src/modules/components/axes/index.ts b/projects/demo/src/modules/components/axes/index.ts
index 07f5d49e60f4..b212f20d1378 100644
--- a/projects/demo/src/modules/components/axes/index.ts
+++ b/projects/demo/src/modules/components/axes/index.ts
@@ -41,29 +41,29 @@ export default class Page {
(index) => (index % 2 ? 'dashed' : 'solid'),
];
- protected axisX = this.lineVariants[0];
+ protected axisX = this.lineVariants[0]!;
- protected axisXLabels = this.labelsXVariants[0];
+ protected axisXLabels = this.labelsXVariants[0]!;
- protected axisY = this.lineVariants[0];
+ protected axisY = this.lineVariants[0]!;
protected axisYInset = false;
- protected axisYLabels = this.labelsYVariants[0];
+ protected axisYLabels = this.labelsYVariants[0]!;
protected axisYName = '';
protected axisYSecondaryInset = false;
- protected axisYSecondaryLabels = this.labelsYVariants[0];
+ protected axisYSecondaryLabels = this.labelsYVariants[0]!;
protected axisYSecondaryName = '';
protected horizontalLines = 0;
- protected horizontalLinesHandler = this.handlerVariants[0];
+ protected horizontalLinesHandler = this.handlerVariants[0]!;
protected verticalLines = 0;
- protected verticalLinesHandler = this.handlerVariants[1];
+ protected verticalLinesHandler = this.handlerVariants[1]!;
}
diff --git a/projects/demo/src/modules/components/badge-notification/index.ts b/projects/demo/src/modules/components/badge-notification/index.ts
index cba850a325fc..b24415da910b 100644
--- a/projects/demo/src/modules/components/badge-notification/index.ts
+++ b/projects/demo/src/modules/components/badge-notification/index.ts
@@ -19,5 +19,5 @@ export default class Example {
'xs',
];
- protected size: TuiSizeL | TuiSizeXS = this.sizeVariants[0];
+ protected size: TuiSizeL | TuiSizeXS = this.sizeVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/badge/index.ts b/projects/demo/src/modules/components/badge/index.ts
index f8828387ea6b..43349dc3a15e 100644
--- a/projects/demo/src/modules/components/badge/index.ts
+++ b/projects/demo/src/modules/components/badge/index.ts
@@ -52,7 +52,7 @@ export default class Page {
'neutral',
];
- protected appearance = this.appearanceVariants[0];
+ protected appearance = this.appearanceVariants[0]!;
protected readonly sizeVariants: ReadonlyArray = [
's',
@@ -61,8 +61,8 @@ export default class Page {
'xl',
];
- protected size: TuiSizeS | TuiSizeXL = this.sizeVariants[1];
+ protected size: TuiSizeS | TuiSizeXL = this.sizeVariants[1]!;
protected contentTypeVariants = ['text', 'with icon', 'image'];
- protected contentType = this.contentTypeVariants[0];
+ protected contentType = this.contentTypeVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/badged-content/index.ts b/projects/demo/src/modules/components/badged-content/index.ts
index 34fb6e35a41a..8755afc1607b 100644
--- a/projects/demo/src/modules/components/badged-content/index.ts
+++ b/projects/demo/src/modules/components/badged-content/index.ts
@@ -20,7 +20,7 @@ import {TuiAvatar, TuiBadgedContent, TuiBadgeNotification} from '@taiga-ui/kit';
})
export default class Example {
protected radiusVariants = ['0.75rem', '50%'];
- protected radius = this.radiusVariants[0];
+ protected radius = this.radiusVariants[0]!;
protected readonly examples = [
'Basic',
diff --git a/projects/demo/src/modules/components/bar-chart/examples/2/index.ts b/projects/demo/src/modules/components/bar-chart/examples/2/index.ts
index bfd1e935057b..c41c3ab39cfe 100644
--- a/projects/demo/src/modules/components/bar-chart/examples/2/index.ts
+++ b/projects/demo/src/modules/components/bar-chart/examples/2/index.ts
@@ -34,10 +34,13 @@ export default class Example {
protected readonly labelsY = ['0', '10 000'];
protected readonly appearances = ['dark', 'error'];
- protected appearance = this.appearances[0];
+ protected appearance = this.appearances[0]!;
protected readonly hint = ({$implicit}: TuiContext): string =>
this.value
- .reduce((result, set) => `${result}$${tuiFormatNumber(set[$implicit])}\n`, '')
+ .reduce(
+ (result, set) => `${result}$${tuiFormatNumber(set[$implicit] ?? 0)}\n`,
+ '',
+ )
.trim();
}
diff --git a/projects/demo/src/modules/components/bar-chart/index.ts b/projects/demo/src/modules/components/bar-chart/index.ts
index 3d0571fdddc4..7d513774fe81 100644
--- a/projects/demo/src/modules/components/bar-chart/index.ts
+++ b/projects/demo/src/modules/components/bar-chart/index.ts
@@ -33,6 +33,6 @@ export default class Page {
],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
protected readonly routes = DemoRoute;
}
diff --git a/projects/demo/src/modules/components/bar-set/index.ts b/projects/demo/src/modules/components/bar-set/index.ts
index 6513a66d9230..fa95b8034723 100644
--- a/projects/demo/src/modules/components/bar-set/index.ts
+++ b/projects/demo/src/modules/components/bar-set/index.ts
@@ -31,5 +31,5 @@ export default class Page {
[237, -50, 10, 5, 1],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/bar/index.ts b/projects/demo/src/modules/components/bar/index.ts
index 1d425494441a..c796ace06c53 100644
--- a/projects/demo/src/modules/components/bar/index.ts
+++ b/projects/demo/src/modules/components/bar/index.ts
@@ -16,12 +16,12 @@ export default class Page {
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size = this.sizeVariants[1];
+ protected size = this.sizeVariants[1]!;
protected readonly valueVariants = [
[30, 20, 10],
[237, 50, 10, 5, 1],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/breadcrumbs/examples/2/index.html b/projects/demo/src/modules/components/breadcrumbs/examples/2/index.html
index 3b8b057d1fd9..c34a3deb1ddb 100644
--- a/projects/demo/src/modules/components/breadcrumbs/examples/2/index.html
+++ b/projects/demo/src/modules/components/breadcrumbs/examples/2/index.html
@@ -15,9 +15,9 @@
- {{ items[index].caption }}
+ {{ items[index]?.caption }}
@@ -26,9 +26,9 @@
*tuiItem
appearance="link"
tuiLink
- [href]="items[index + items.length - max].link"
+ [href]="items[index + items.length - max]?.link"
>
- {{ items[index + items.length - max].caption }}
+ {{ items[index + items.length - max]?.caption }}
diff --git a/projects/demo/src/modules/components/breadcrumbs/index.ts b/projects/demo/src/modules/components/breadcrumbs/index.ts
index 99dc8146c51f..0ffe1625c54b 100644
--- a/projects/demo/src/modules/components/breadcrumbs/index.ts
+++ b/projects/demo/src/modules/components/breadcrumbs/index.ts
@@ -34,11 +34,11 @@ export default class Example {
],
];
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
protected readonly sizeVariants: readonly TuiSizeL[] = ['m', 'l'];
- protected size: TuiSizeL = this.sizeVariants[0];
+ protected size: TuiSizeL = this.sizeVariants[0]!;
protected readonly examples = [
{name: 'Basic'},
diff --git a/projects/demo/src/modules/components/button/index.ts b/projects/demo/src/modules/components/button/index.ts
index 501b528accc9..ed6ac8f0e480 100644
--- a/projects/demo/src/modules/components/button/index.ts
+++ b/projects/demo/src/modules/components/button/index.ts
@@ -23,7 +23,7 @@ export default class Page {
protected readonly sizes: ReadonlyArray = ['xs', 's', 'm', 'l'];
- protected size = this.sizes[3];
+ protected size = this.sizes[3]!;
protected readonly appearances = [
'primary',
@@ -37,12 +37,12 @@ export default class Page {
'floating',
];
- protected appearance = this.appearances[0];
+ protected appearance = this.appearances[0]!;
protected readonly icons = ['', '@tui.search', '@tui.chevron-down'];
- protected iconStart = this.icons[0];
- protected iconEnd = this.icons[0];
+ protected iconStart = this.icons[0]!;
+ protected iconEnd = this.icons[0]!;
protected loading = false;
}
diff --git a/projects/demo/src/modules/components/calendar-month/index.ts b/projects/demo/src/modules/components/calendar-month/index.ts
index 51a58e3063b4..5db7c64495d2 100644
--- a/projects/demo/src/modules/components/calendar-month/index.ts
+++ b/projects/demo/src/modules/components/calendar-month/index.ts
@@ -39,8 +39,8 @@ export default class Example {
new TuiMonth(2019, 4),
];
- protected min = this.minVariants[0];
- protected max = this.maxVariants[0];
+ protected min = this.minVariants[0]!;
+ protected max = this.maxVariants[0]!;
protected maxLength = 0;
protected minLength = 0;
@@ -48,7 +48,7 @@ export default class Example {
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({month}) => month % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly valueVariants: ReadonlyArray = [
TuiDay.currentLocal(),
@@ -66,6 +66,6 @@ export default class Example {
new TuiYear(2007),
];
- protected year = this.yearVariants[0];
+ protected year = this.yearVariants[0]!;
protected readonly routes = DemoRoute;
}
diff --git a/projects/demo/src/modules/components/calendar-range/examples/5/index.ts b/projects/demo/src/modules/components/calendar-range/examples/5/index.ts
index 3be44d21ca46..09d5e1435645 100644
--- a/projects/demo/src/modules/components/calendar-range/examples/5/index.ts
+++ b/projects/demo/src/modules/components/calendar-range/examples/5/index.ts
@@ -33,7 +33,7 @@ export default class Example {
protected value: TuiDayRange | null = this.default.range;
public get default(): TuiDayRangePeriod {
- return this.items[0];
+ return this.items[0]!;
}
public get isDefault(): boolean {
@@ -57,9 +57,9 @@ export default class Example {
case this.default:
return null;
case this.items[1]:
- return this.items[2];
+ return this.items[2]!;
case this.items[2]:
- return this.items[3];
+ return this.items[3]!;
case this.items[3]:
return null;
default:
diff --git a/projects/demo/src/modules/components/calendar-range/index.ts b/projects/demo/src/modules/components/calendar-range/index.ts
index b423518b46df..f28d1035a935 100644
--- a/projects/demo/src/modules/components/calendar-range/index.ts
+++ b/projects/demo/src/modules/components/calendar-range/index.ts
@@ -77,12 +77,12 @@ export default class Example {
];
protected markerHandler: TuiMarkerHandler | null = null;
- protected min: TuiDay = this.minVariants[0];
- protected max: TuiDay = this.maxVariants[0];
+ protected min: TuiDay = this.minVariants[0]!;
+ protected max: TuiDay = this.maxVariants[0]!;
protected cleaner = false;
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
- protected items = this.itemsVariants[0];
- protected defaultViewedMonth = this.defaultViewedMonthVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
+ protected items = this.itemsVariants[0]!;
+ protected defaultViewedMonth = this.defaultViewedMonthVariants[0]!;
protected minLength: TuiDayLike | null = null;
protected maxLength: TuiDayLike | null = null;
protected readonly routes = DemoRoute;
diff --git a/projects/demo/src/modules/components/calendar/index.ts b/projects/demo/src/modules/components/calendar/index.ts
index 38fc20423c2b..6518f082064c 100644
--- a/projects/demo/src/modules/components/calendar/index.ts
+++ b/projects/demo/src/modules/components/calendar/index.ts
@@ -46,7 +46,7 @@ export default class Example {
new TuiDay(1900, 0, 1),
];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected readonly maxVariants = [
TUI_LAST_DAY,
@@ -54,7 +54,7 @@ export default class Example {
new TuiDay(2300, 0, 1),
];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected readonly minViewedMonthVariants = [
new TuiMonth(0, 0),
@@ -62,7 +62,7 @@ export default class Example {
new TuiMonth(1900, 0),
];
- protected minViewedMonth = this.minViewedMonthVariants[0];
+ protected minViewedMonth = this.minViewedMonthVariants[0]!;
protected readonly maxViewedMonthVariants = [
TUI_LAST_DAY,
@@ -70,13 +70,13 @@ export default class Example {
new TuiMonth(2300, 0),
];
- protected maxViewedMonth = this.maxViewedMonthVariants[0];
+ protected maxViewedMonth = this.maxViewedMonthVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly markerHandlerVariants: readonly TuiMarkerHandler[] = [
(day: TuiDay) => (day.day % 2 === 0 ? TWO_DOTS : ONE_DOT),
diff --git a/projects/demo/src/modules/components/carousel/index.ts b/projects/demo/src/modules/components/carousel/index.ts
index 5a024b315c0c..32298a86950c 100644
--- a/projects/demo/src/modules/components/carousel/index.ts
+++ b/projects/demo/src/modules/components/carousel/index.ts
@@ -24,8 +24,8 @@ export default class Example {
protected readonly durationVariants = [0, 3000, 10000];
protected readonly itemPaddingVariants = [null, '0 10px', '0'];
protected draggable = false;
- protected duration = this.durationVariants[0];
- protected itemPadding: string | null = this.itemPaddingVariants[0];
+ protected duration = this.durationVariants[0]!;
+ protected itemPadding: string | null = this.itemPaddingVariants[0]!;
protected index = 0;
protected itemsCount = 1;
}
diff --git a/projects/demo/src/modules/components/cell/examples/7/index.ts b/projects/demo/src/modules/components/cell/examples/7/index.ts
index 1db266e41412..1ef8e5dc0879 100644
--- a/projects/demo/src/modules/components/cell/examples/7/index.ts
+++ b/projects/demo/src/modules/components/cell/examples/7/index.ts
@@ -47,5 +47,5 @@ export default class Example {
},
];
- protected value = this.items[0];
+ protected value = this.items[0]!;
}
diff --git a/projects/demo/src/modules/components/cell/examples/8/index.ts b/projects/demo/src/modules/components/cell/examples/8/index.ts
index 5770f333044a..45351a28ccfa 100644
--- a/projects/demo/src/modules/components/cell/examples/8/index.ts
+++ b/projects/demo/src/modules/components/cell/examples/8/index.ts
@@ -59,7 +59,7 @@ export default class Example {
},
];
- protected value = this.items[0];
+ protected value = this.items[0]!;
protected incoming = false;
protected outgoing = true;
diff --git a/projects/demo/src/modules/components/combo-box/index.ts b/projects/demo/src/modules/components/combo-box/index.ts
index 23d126bc9d21..7c7756d0ac1c 100644
--- a/projects/demo/src/modules/components/combo-box/index.ts
+++ b/projects/demo/src/modules/components/combo-box/index.ts
@@ -99,7 +99,7 @@ export default class Example extends AbstractExampleTuiControl {
(item) => String(String(item).match(/\d+/)),
];
- protected stringify = this.stringifyVariants[0];
+ protected stringify = this.stringifyVariants[0]!;
protected readonly strictMatcherVariants: ReadonlyArray> = [
TUI_STRICT_MATCHER as TuiStringMatcher,
@@ -108,7 +108,7 @@ export default class Example extends AbstractExampleTuiControl {
Number.parseInt(search, 10),
];
- protected strictMatcher = this.strictMatcherVariants[0];
+ protected strictMatcher = this.strictMatcherVariants[0]!;
protected readonly identityMatcherVariants: ReadonlyArray<
TuiIdentityMatcher
@@ -117,13 +117,13 @@ export default class Example extends AbstractExampleTuiControl {
(item1, item2) => item1.balance === item2.balance,
];
- protected identityMatcher = this.identityMatcherVariants[0];
+ protected identityMatcher = this.identityMatcherVariants[0]!;
public readonly control = new FormControl(null, Validators.required);
public readonly iconVariants = ['', '@tui.pie-chart', '@tui.credit-card'];
- public override iconStart = this.iconVariants[0];
+ public override iconStart = this.iconVariants[0]!;
protected get valueContent(): PolymorpheusContent> {
return this.valueTemplateRef && this.selectedValueTemplate
diff --git a/projects/demo/src/modules/components/compass/index.ts b/projects/demo/src/modules/components/compass/index.ts
index 104df7ee9436..7118a896ec84 100644
--- a/projects/demo/src/modules/components/compass/index.ts
+++ b/projects/demo/src/modules/components/compass/index.ts
@@ -17,7 +17,7 @@ export default class Page {
'',
];
- protected color = this.colorVariants[0];
+ protected color = this.colorVariants[0]!;
protected degrees = 90;
}
diff --git a/projects/demo/src/modules/components/confirm/index.ts b/projects/demo/src/modules/components/confirm/index.ts
index 04eb2b48123d..638ebe74d9ed 100644
--- a/projects/demo/src/modules/components/confirm/index.ts
+++ b/projects/demo/src/modules/components/confirm/index.ts
@@ -22,7 +22,7 @@ export default class Example implements TuiConfirmData {
protected readonly exampleService = import('./examples/import/service.md?raw');
public readonly appearances = ['primary', 'accent', 'secondary'];
- public appearance = this.appearances[0];
+ public appearance = this.appearances[0]!;
public no = 'No';
public yes = 'Yes';
diff --git a/projects/demo/src/modules/components/dialog/examples/9/helpers/pay.service.ts b/projects/demo/src/modules/components/dialog/examples/9/helpers/pay.service.ts
index f2126b1f62fd..91de4ad18e79 100644
--- a/projects/demo/src/modules/components/dialog/examples/9/helpers/pay.service.ts
+++ b/projects/demo/src/modules/components/dialog/examples/9/helpers/pay.service.ts
@@ -19,7 +19,7 @@ export class PayService {
public getPrimaryCard(): Observable {
return timer(this.getRandomDelay()).pipe(
map(() => MOCK_CARDS),
- map((cards: AccountCard[]) => ({primary: cards[0], cards})),
+ map((cards: AccountCard[]) => ({primary: cards[0]!, cards})),
);
}
diff --git a/projects/demo/src/modules/components/dialog/index.ts b/projects/demo/src/modules/components/dialog/index.ts
index 729c60720d2a..87e979f2a74a 100644
--- a/projects/demo/src/modules/components/dialog/index.ts
+++ b/projects/demo/src/modules/components/dialog/index.ts
@@ -100,7 +100,7 @@ export default class Page {
'auto',
];
- protected size: TuiDialogSize = this.sizeVariants[1];
+ protected size: TuiDialogSize = this.sizeVariants[1]!;
protected label = '';
diff --git a/projects/demo/src/modules/components/error/index.ts b/projects/demo/src/modules/components/error/index.ts
index aadc0c565e29..a9e9357772a4 100644
--- a/projects/demo/src/modules/components/error/index.ts
+++ b/projects/demo/src/modules/components/error/index.ts
@@ -20,7 +20,7 @@ export default class Page {
'Error as HTML content',
];
- protected selectedError = this.errorVariants[0];
+ protected selectedError = this.errorVariants[0]!;
protected get error(): TuiValidationError | string | null {
if (this.selectedError === null) {
diff --git a/projects/demo/src/modules/components/filter/examples/3/index.ts b/projects/demo/src/modules/components/filter/examples/3/index.ts
index 29917d20931f..18d67e62a150 100644
--- a/projects/demo/src/modules/components/filter/examples/3/index.ts
+++ b/projects/demo/src/modules/components/filter/examples/3/index.ts
@@ -30,6 +30,6 @@ export default class Example {
});
protected getItemIcon(title: string): string {
- return getIcon[title];
+ return getIcon[title] ?? '';
}
}
diff --git a/projects/demo/src/modules/components/filter/index.ts b/projects/demo/src/modules/components/filter/index.ts
index efc2aec2ff38..e30a513d758d 100644
--- a/projects/demo/src/modules/components/filter/index.ts
+++ b/projects/demo/src/modules/components/filter/index.ts
@@ -46,7 +46,7 @@ export default class Page {
(item) => String(item).length,
];
- protected badgeHandler = this.badgeHandlerVariants[0];
+ protected badgeHandler = this.badgeHandlerVariants[0]!;
protected disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
@@ -56,13 +56,13 @@ export default class Page {
(item) => (Number(item.valueOf()) || 0) >= 30,
];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
protected control = new FormControl(this.initialItems);
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
}
diff --git a/projects/demo/src/modules/components/group/index.ts b/projects/demo/src/modules/components/group/index.ts
index 55547eae4013..e3878fca1b27 100644
--- a/projects/demo/src/modules/components/group/index.ts
+++ b/projects/demo/src/modules/components/group/index.ts
@@ -21,10 +21,10 @@ export default class Page {
'vertical',
];
- protected orientation: TuiOrientation = this.orientationVariants[0];
+ protected orientation: TuiOrientation = this.orientationVariants[0]!;
protected readonly sizeVariants: readonly TuiSizeL[] = ['m', 'l'];
- protected size: TuiSizeL = this.sizeVariants[1];
+ protected size: TuiSizeL = this.sizeVariants[1]!;
protected readonly routes = DemoRoute;
}
diff --git a/projects/demo/src/modules/components/icon/index.ts b/projects/demo/src/modules/components/icon/index.ts
index 483566588323..e3d72aac71c0 100644
--- a/projects/demo/src/modules/components/icon/index.ts
+++ b/projects/demo/src/modules/components/icon/index.ts
@@ -34,7 +34,7 @@ export default class Page {
protected icon = '@tui.heart';
protected backgroundIcon = '';
- protected color = this.colorVariants[1];
+ protected color = this.colorVariants[1]!;
protected backgroundColor = '';
protected size = 24;
}
diff --git a/projects/demo/src/modules/components/input-copy/index.ts b/projects/demo/src/modules/components/input-copy/index.ts
index ae7b87449600..00f430fc24bb 100644
--- a/projects/demo/src/modules/components/input-copy/index.ts
+++ b/projects/demo/src/modules/components/input-copy/index.ts
@@ -33,10 +33,10 @@ export default class PageComponent extends AbstractExampleTuiControl {
protected readonly successMessageVariants = ['Copied', 'Template'];
- protected successMessage = this.successMessageVariants[0];
+ protected successMessage = this.successMessageVariants[0]!;
- protected messageDirection = this.hintDirectionVariants[0];
- protected messageMode = this.hintAppearanceVariants[0];
+ protected messageDirection = this.hintDirectionVariants[0]!;
+ protected messageMode = this.hintAppearanceVariants[0]!;
public readonly control = new FormControl('', Validators.required);
diff --git a/projects/demo/src/modules/components/input-date-multi/index.ts b/projects/demo/src/modules/components/input-date-multi/index.ts
index 8d913a75e6f7..049919c47498 100644
--- a/projects/demo/src/modules/components/input-date-multi/index.ts
+++ b/projects/demo/src/modules/components/input-date-multi/index.ts
@@ -47,7 +47,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiDay(new Date().getFullYear() + 3, 1, 1),
];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected maxVariants = [
TUI_LAST_DAY,
@@ -56,17 +56,17 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiDay(2300, 0, 1),
];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected rowsVariants = [Infinity, 10, 3, 2];
- protected rows = this.rowsVariants[0];
+ protected rows = this.rowsVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly markerHandlerVariants: readonly TuiMarkerHandler[] = [
(day: TuiDay) =>
diff --git a/projects/demo/src/modules/components/input-date-range/index.ts b/projects/demo/src/modules/components/input-date-range/index.ts
index fd51df503dfc..ed2925f706ad 100644
--- a/projects/demo/src/modules/components/input-date-range/index.ts
+++ b/projects/demo/src/modules/components/input-date-range/index.ts
@@ -59,13 +59,13 @@ export default class PageComponent extends AbstractExampleTuiControl {
TUI_LAST_DAY,
];
- protected min: TuiDay = this.dayVariants[0];
+ protected min: TuiDay = this.dayVariants[0]!;
protected readonly minLengthVariants: readonly TuiDayLike[] = [{day: 3}, {day: 15}];
protected minLength: TuiDayLike | null = null;
- protected max = this.dayVariants[this.dayVariants.length - 1];
+ protected max = this.dayVariants[this.dayVariants.length - 1]!;
protected readonly markerHandlerVariants: readonly TuiMarkerHandler[] = [
(day: TuiDay) => (day.day % 2 === 0 ? TWO_DOTS : ONE_DOT),
@@ -77,14 +77,14 @@ export default class PageComponent extends AbstractExampleTuiControl {
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly itemsVariants: ReadonlyArray = [
[],
tuiCreateDefaultDayRangePeriods(),
];
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
protected readonly defaultViewedMonthVariants: readonly TuiMonth[] = [
TuiMonth.currentLocal(),
@@ -92,7 +92,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiMonth(2007, 5),
];
- protected defaultViewedMonth = this.defaultViewedMonthVariants[0];
+ protected defaultViewedMonth = this.defaultViewedMonthVariants[0]!;
public override cleaner = false;
public control = new FormControl(null, Validators.required);
diff --git a/projects/demo/src/modules/components/input-date-time/index.ts b/projects/demo/src/modules/components/input-date-time/index.ts
index c8d48867c87b..2de688b074dd 100644
--- a/projects/demo/src/modules/components/input-date-time/index.ts
+++ b/projects/demo/src/modules/components/input-date-time/index.ts
@@ -51,7 +51,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
[this.today.append({day: -1}), new TuiTime(12, 20)],
];
- protected min: TuiDay | [TuiDay, TuiTime] = this.minVariants[0];
+ protected min: TuiDay | [TuiDay, TuiTime] = this.minVariants[0]!;
protected readonly maxVariants: ReadonlyArray = [
TUI_LAST_DAY,
@@ -61,7 +61,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
[this.today.append({day: +1}), new TuiTime(16, 20)],
];
- protected max: TuiDay | [TuiDay, TuiTime] = this.maxVariants[0];
+ protected max: TuiDay | [TuiDay, TuiTime] = this.maxVariants[0]!;
protected defaultActiveYearMonthVariants = [
TuiMonth.currentLocal(),
@@ -69,20 +69,20 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiMonth(2017, 2),
];
- protected defaultActiveYearMonth = this.defaultActiveYearMonthVariants[0];
+ protected defaultActiveYearMonth = this.defaultActiveYearMonthVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly itemsVariants = [
[],
[new TuiNamedDay(TUI_LAST_DAY.append({year: -1}), 'Until today')],
];
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
protected readonly modeVariants: readonly TuiTimeMode[] = [
'HH:MM',
@@ -90,7 +90,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
'HH:MM:SS.MSS',
];
- protected mode = this.modeVariants[0];
+ protected mode = this.modeVariants[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input-date/index.ts b/projects/demo/src/modules/components/input-date/index.ts
index 44e44f8a30f0..49b4e52c41e8 100644
--- a/projects/demo/src/modules/components/input-date/index.ts
+++ b/projects/demo/src/modules/components/input-date/index.ts
@@ -63,7 +63,7 @@ export default class Example extends AbstractExampleTuiControl {
new TuiDay(new Date().getFullYear() + 3, 1, 1),
];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected maxVariants = [
TUI_LAST_DAY,
@@ -72,13 +72,13 @@ export default class Example extends AbstractExampleTuiControl {
new TuiDay(2300, 0, 1),
];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly itemsVariants = [
[],
@@ -91,7 +91,7 @@ export default class Example extends AbstractExampleTuiControl {
protected markerHandler: TuiMarkerHandler | null = null;
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input-files/index.ts b/projects/demo/src/modules/components/input-files/index.ts
index ab449ba7b2d8..2c0e8df8fe3d 100644
--- a/projects/demo/src/modules/components/input-files/index.ts
+++ b/projects/demo/src/modules/components/input-files/index.ts
@@ -40,10 +40,10 @@ export default class PageComponent extends AbstractExampleTuiControl {
];
protected rejected: readonly File[] = [];
- protected maxFileSize = this.maxFileSizeVariants[2];
+ protected maxFileSize = this.maxFileSizeVariants[2]!;
public override readonly sizeVariants: readonly TuiSizeL[] = ['m', 'l'];
- public override size = this.sizeVariants[0];
+ public override size = this.sizeVariants[0]!;
public readonly control = new FormControl(null);
public readonly files$ = this.control.valueChanges.pipe(
map(() => tuiFilesAccepted(this.control)),
diff --git a/projects/demo/src/modules/components/input-month-range/index.ts b/projects/demo/src/modules/components/input-month-range/index.ts
index a99b3e1f1f2a..5247449b6853 100644
--- a/projects/demo/src/modules/components/input-month-range/index.ts
+++ b/projects/demo/src/modules/components/input-month-range/index.ts
@@ -47,15 +47,15 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiMonth(2023, 0),
];
- protected min = this.minVariants[0];
- protected max = this.maxVariants[0];
+ protected min = this.minVariants[0]!;
+ protected max = this.maxVariants[0]!;
protected minLength = 0;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({month}) => month % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
public override cleaner = false;
public override maxLength = 0;
diff --git a/projects/demo/src/modules/components/input-month/index.ts b/projects/demo/src/modules/components/input-month/index.ts
index f3f9ac7c9929..fe9e4fb8b995 100644
--- a/projects/demo/src/modules/components/input-month/index.ts
+++ b/projects/demo/src/modules/components/input-month/index.ts
@@ -45,14 +45,14 @@ export default class PageComponent extends AbstractExampleTuiControl {
new TuiMonth(2023, 0),
];
- protected min = this.minVariants[0];
- protected max = this.maxVariants[0];
+ protected min = this.minVariants[0]!;
+ protected max = this.maxVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({month}) => month % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input-number/index.ts b/projects/demo/src/modules/components/input-number/index.ts
index 1b6d63c3d982..5ce6ad3c08f8 100644
--- a/projects/demo/src/modules/components/input-number/index.ts
+++ b/projects/demo/src/modules/components/input-number/index.ts
@@ -32,11 +32,11 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
protected readonly minVariants: readonly number[] = [-Infinity, -500, 5, 25];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected readonly maxVariants: readonly number[] = [Infinity, 10, 500];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected step = 0;
diff --git a/projects/demo/src/modules/components/input-phone-international/index.ts b/projects/demo/src/modules/components/input-phone-international/index.ts
index a1ae046b9bbd..16100c310c1c 100644
--- a/projects/demo/src/modules/components/input-phone-international/index.ts
+++ b/projects/demo/src/modules/components/input-phone-international/index.ts
@@ -41,7 +41,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
getCountries(),
];
- protected countries = this.countriesVariants[0];
+ protected countries = this.countriesVariants[0]!;
protected readonly countryIsoCodeVariants: readonly TuiCountryIsoCode[] = [
'RU',
@@ -50,7 +50,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
'BY',
];
- protected countryIsoCode = this.countryIsoCodeVariants[0];
+ protected countryIsoCode = this.countryIsoCodeVariants[0]!;
public override cleaner = false;
public control = new FormControl('', [Validators.required, Validators.minLength(9)]);
diff --git a/projects/demo/src/modules/components/input-phone/examples/3/index.ts b/projects/demo/src/modules/components/input-phone/examples/3/index.ts
index c58a171d839c..1b806b02c7da 100644
--- a/projects/demo/src/modules/components/input-phone/examples/3/index.ts
+++ b/projects/demo/src/modules/components/input-phone/examples/3/index.ts
@@ -138,7 +138,7 @@ export default class Example {
private isFullMatch(response: readonly User[], value: string): boolean {
return (
response.length === 1 &&
- (String(response[0]) === value || response[0].phone === value)
+ (String(response[0]) === value || response[0]?.phone === value)
);
}
}
diff --git a/projects/demo/src/modules/components/input-phone/index.ts b/projects/demo/src/modules/components/input-phone/index.ts
index 3ffb766d4d8c..bea0750d6ee6 100644
--- a/projects/demo/src/modules/components/input-phone/index.ts
+++ b/projects/demo/src/modules/components/input-phone/index.ts
@@ -29,7 +29,7 @@ import {InheritedDocumentation} from '../abstract/inherited-documentation';
export default class PageComponent extends AbstractExampleTuiControl {
protected countryCodes = ['+7', '+850', '+1', '+52'];
- protected countryCode = this.countryCodes[0];
+ protected countryCode = this.countryCodes[0]!;
protected phoneMasksAfterCountryCode = [
'(###) ###-##-##',
@@ -37,7 +37,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
'### ###-####',
];
- protected phoneMaskAfterCountryCode = this.phoneMasksAfterCountryCode[0];
+ protected phoneMaskAfterCountryCode = this.phoneMasksAfterCountryCode[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input-range/index.ts b/projects/demo/src/modules/components/input-range/index.ts
index 38c12ffbf524..c0e243d4e641 100644
--- a/projects/demo/src/modules/components/input-range/index.ts
+++ b/projects/demo/src/modules/components/input-range/index.ts
@@ -36,11 +36,11 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
protected readonly routes = DemoRoute;
protected minVariants: readonly number[] = [0, 5, 7.77, -10];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected maxVariants: readonly number[] = [10, 100, 10000];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected segments = 1;
@@ -48,7 +48,7 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
protected quantumVariants: readonly number[] = [1, 0.001, 10, 100];
- protected quantum = this.quantumVariants[0];
+ protected quantum = this.quantumVariants[0]!;
protected readonly pluralizeVariants: ReadonlyArray> = [
{one: 'thing', few: 'things', many: 'things', other: 'things'},
@@ -78,12 +78,12 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
({$implicit: val}: TuiContext) => (val === 5 ? 'FIVE' : `${val}`),
];
- protected leftValueContent = this.valueContentVariants[0];
- protected rightValueContent = this.valueContentVariants[0];
+ protected leftValueContent = this.valueContentVariants[0]!;
+ protected rightValueContent = this.valueContentVariants[0]!;
public control = new FormControl([0, 10]);
public override sizeVariants: readonly TuiSizeL[] = ['m', 'l'];
- public override size = this.sizeVariants[1];
+ public override size = this.sizeVariants[1]!;
}
diff --git a/projects/demo/src/modules/components/input-slider/index.ts b/projects/demo/src/modules/components/input-slider/index.ts
index 50d445901117..862115835aa1 100644
--- a/projects/demo/src/modules/components/input-slider/index.ts
+++ b/projects/demo/src/modules/components/input-slider/index.ts
@@ -37,11 +37,11 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
protected readonly routes = DemoRoute;
protected readonly minVariants: readonly number[] = [0, 1, 5, 7.77, -10];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected readonly maxVariants: readonly number[] = [10, 100, 10000];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected segments = 1;
@@ -51,7 +51,7 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
1, 0.01, 0.001, 0.0001, 10, 20, 100,
];
- protected quantum = this.quantumVariants[0];
+ protected quantum = this.quantumVariants[0]!;
protected readonly valueContentVariants = [
'',
@@ -61,7 +61,7 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
({$implicit: val}: TuiContext) => (val === 5 ? 'FIVE' : val),
];
- protected valueContent = this.valueContentVariants[0];
+ protected valueContent = this.valueContentVariants[0]!;
protected readonly keyStepsVariants: readonly TuiKeySteps[] = [
[
@@ -74,7 +74,7 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
protected keySteps: TuiKeySteps | null = null;
public override readonly sizeVariants: readonly TuiSizeL[] = ['m', 'l'];
- public override size = this.sizeVariants[1];
+ public override size = this.sizeVariants[1]!;
public readonly control = new FormControl(0);
public override readonly customContentVariants: string[] = [
@@ -83,5 +83,5 @@ export default class PageComponent extends AbstractExampleTuiNumberFormat {
'@tui.mastercard-mono',
];
- public override customContentSelected = this.customContentVariants[0];
+ public override customContentSelected = this.customContentVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/input-tag/index.ts b/projects/demo/src/modules/components/input-tag/index.ts
index 995801776b1d..1d8b9885b502 100644
--- a/projects/demo/src/modules/components/input-tag/index.ts
+++ b/projects/demo/src/modules/components/input-tag/index.ts
@@ -46,7 +46,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
protected readonly separatorVariants = [',', ';', /[\d]/, /[\s,]/];
- protected separator = this.separatorVariants[0];
+ protected separator = this.separatorVariants[0]!;
protected readonly iconVariants: readonly string[] = ['@tui.search'];
@@ -62,7 +62,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
(item) => item !== 'mail',
];
- protected tagValidator = this.tagValidatorVariants[0];
+ protected tagValidator = this.tagValidatorVariants[0]!;
protected inputHidden = false;
@@ -70,7 +70,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
TuiBooleanHandler | string>
> = [TUI_FALSE_HANDLER, (item) => String(item).startsWith('T')];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
public override readonly sizeVariants: ReadonlyArray = [
's',
@@ -79,7 +79,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
];
public override size: TuiSizeL | TuiSizeS =
- this.sizeVariants[this.sizeVariants.length - 1];
+ this.sizeVariants[this.sizeVariants.length - 1]!;
public readonly control = new FormControl(
['John Cleese', 'Eric Idle', 'Michael Palin'],
diff --git a/projects/demo/src/modules/components/input-time/index.ts b/projects/demo/src/modules/components/input-time/index.ts
index 4b78e45e9dde..589ae6e62148 100644
--- a/projects/demo/src/modules/components/input-time/index.ts
+++ b/projects/demo/src/modules/components/input-time/index.ts
@@ -40,7 +40,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
(item: TuiTime) => String(item) === '06:00' || item > TuiTime.currentLocal(),
];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected readonly itemSizeVariants: ReadonlyArray = [
's',
@@ -48,14 +48,14 @@ export default class PageComponent extends AbstractExampleTuiControl {
'l',
];
- protected itemSize: TuiSizeL | TuiSizeS = this.itemSizeVariants[1];
+ protected itemSize: TuiSizeL | TuiSizeS = this.itemSizeVariants[1]!;
protected readonly itemsVariants: ReadonlyArray = [
[],
tuiCreateTimePeriods(),
];
- protected items = this.itemsVariants[0];
+ protected items = this.itemsVariants[0]!;
protected strict = false;
@@ -65,7 +65,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
'HH:MM:SS.MSS',
];
- protected mode = this.modeVariants[0];
+ protected mode = this.modeVariants[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input-year/index.ts b/projects/demo/src/modules/components/input-year/index.ts
index 7185845bf2a0..093b82da21b7 100644
--- a/projects/demo/src/modules/components/input-year/index.ts
+++ b/projects/demo/src/modules/components/input-year/index.ts
@@ -27,14 +27,14 @@ export default class PageComponent extends AbstractExampleTuiControl {
protected readonly minVariants = [TUI_FIRST_DAY.year, 2019, 2007];
protected readonly maxVariants = [TUI_LAST_DAY.year, 2020, 2023];
- protected min = this.minVariants[0];
- protected max = this.maxVariants[0];
+ protected min = this.minVariants[0]!;
+ protected max = this.maxVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, (year) => year % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
public override cleaner = false;
diff --git a/projects/demo/src/modules/components/input/examples/4/index.ts b/projects/demo/src/modules/components/input/examples/4/index.ts
index 52cd20248159..d3a9790b58b1 100644
--- a/projects/demo/src/modules/components/input/examples/4/index.ts
+++ b/projects/demo/src/modules/components/input/examples/4/index.ts
@@ -141,7 +141,9 @@ export default class Example {
return filtered;
}
- this.onSelected(filtered[0]);
+ if (filtered[0]) {
+ this.onSelected(filtered[0]);
+ }
return [];
}),
diff --git a/projects/demo/src/modules/components/input/examples/8/index.ts b/projects/demo/src/modules/components/input/examples/8/index.ts
index c6f39d167213..b8de13618ffe 100644
--- a/projects/demo/src/modules/components/input/examples/8/index.ts
+++ b/projects/demo/src/modules/components/input/examples/8/index.ts
@@ -59,7 +59,11 @@ export default class Example {
switchMap((value) =>
this.request(value ?? '').pipe(
map((response) => {
- if (response.length === 1 && String(response[0]) === value) {
+ if (
+ response.length === 1 &&
+ response[0] &&
+ String(response[0]) === value
+ ) {
this.onClick(response[0]);
return [];
diff --git a/projects/demo/src/modules/components/input/index.ts b/projects/demo/src/modules/components/input/index.ts
index 330478523c05..e3205c743f78 100644
--- a/projects/demo/src/modules/components/input/index.ts
+++ b/projects/demo/src/modules/components/input/index.ts
@@ -43,9 +43,9 @@ export default class PageComponent extends AbstractExampleTuiControl {
public readonly iconVariants = ['', '@tui.search', '@tui.calendar'];
- public icon = this.iconVariants[0];
+ public icon = this.iconVariants[0]!;
- public override iconStart = this.iconVariants[0];
+ public override iconStart = this.iconVariants[0]!;
public readonly control = new FormControl('111', Validators.required);
diff --git a/projects/demo/src/modules/components/island/index.ts b/projects/demo/src/modules/components/island/index.ts
index 5e63c5cd597c..cf29d7b45359 100644
--- a/projects/demo/src/modules/components/island/index.ts
+++ b/projects/demo/src/modules/components/island/index.ts
@@ -24,6 +24,6 @@ export default class Page {
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size: TuiSizeL | TuiSizeS = this.sizeVariants[0];
+ protected size: TuiSizeL | TuiSizeS = this.sizeVariants[0]!;
protected readonly routes = DemoRoute;
}
diff --git a/projects/demo/src/modules/components/items-with-more/index.ts b/projects/demo/src/modules/components/items-with-more/index.ts
index af970a859a9e..e08a39143931 100644
--- a/projects/demo/src/modules/components/items-with-more/index.ts
+++ b/projects/demo/src/modules/components/items-with-more/index.ts
@@ -16,7 +16,7 @@ export default class Page {
protected readonly itemsLimitVariants = [Infinity, 4, 2];
- protected required = this.requiredVariants[0];
+ protected required = this.requiredVariants[0]!;
- protected itemsLimit = this.itemsLimitVariants[0];
+ protected itemsLimit = this.itemsLimitVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/legend-item/examples/1/index.html b/projects/demo/src/modules/components/legend-item/examples/1/index.html
index caed141343d6..93082ea0f2ed 100644
--- a/projects/demo/src/modules/components/legend-item/examples/1/index.html
+++ b/projects/demo/src/modules/components/legend-item/examples/1/index.html
@@ -17,7 +17,7 @@
[text]="label"
(tuiHoveredChange)="onHover(index, $event)"
>
- {{ value[index] | tuiAmount: 'RUB' | async }}
+ {{ value[index] || 0 | tuiAmount: 'RUB' | async }}
diff --git a/projects/demo/src/modules/components/legend-item/examples/2/index.html b/projects/demo/src/modules/components/legend-item/examples/2/index.html
index a8a49c45492e..ec341fde95da 100644
--- a/projects/demo/src/modules/components/legend-item/examples/2/index.html
+++ b/projects/demo/src/modules/components/legend-item/examples/2/index.html
@@ -27,7 +27,7 @@
type="checkbox"
[checked]="!item.disabled"
/>
- {{ data[index] | tuiAmount: 'RUB' | async }}
+ {{ data[index] || 0 | tuiAmount: 'RUB' | async }}
): number => $implicit[0][1];
+ }: TuiContext): number => $implicit[0]?.[1] ?? 0;
}
diff --git a/projects/demo/src/modules/components/line-chart/examples/5/index.ts b/projects/demo/src/modules/components/line-chart/examples/5/index.ts
index 1f0326d7c3b3..47eef29ad66f 100644
--- a/projects/demo/src/modules/components/line-chart/examples/5/index.ts
+++ b/projects/demo/src/modules/components/line-chart/examples/5/index.ts
@@ -47,5 +47,5 @@ export default class Example {
protected readonly hint: TuiStringHandler> = ({
$implicit,
- }) => `${$implicit[0][0]} items:\n\n${$implicit.map(([_, y]) => y).join('$\n')}$`;
+ }) => `${$implicit[0]?.[0]} items:\n\n${$implicit.map(([_, y]) => y).join('$\n')}$`;
}
diff --git a/projects/demo/src/modules/components/line-days-chart/examples/1/index.ts b/projects/demo/src/modules/components/line-days-chart/examples/1/index.ts
index d52e6ab93375..56fa26bf6ff7 100644
--- a/projects/demo/src/modules/components/line-days-chart/examples/1/index.ts
+++ b/projects/demo/src/modules/components/line-days-chart/examples/1/index.ts
@@ -59,7 +59,7 @@ export default class Example {
map((months) => [
...Array.from(
{length: TuiMonth.lengthBetween(from, to) + 1},
- (_, i) => months[from.append({month: i}).month],
+ (_, i) => months[from.append({month: i}).month] ?? '',
),
null,
]),
@@ -75,6 +75,6 @@ export default class Example {
.fill(0)
.reduce<
ReadonlyArray<[TuiDay, number]>
- >((array, _, i) => [...array, [from.append({day: i}), this.isE2E ? 100 : (i ? array[i - 1][1] : 100) + Math.random() * 10 - 5]], []);
+ >((array, _, i) => [...array, [from.append({day: i}), this.isE2E ? 100 : (i ? (array[i - 1]?.[1] ?? 0) : 100) + Math.random() * 10 - 5]], []);
}
}
diff --git a/projects/demo/src/modules/components/line-days-chart/examples/2/index.ts b/projects/demo/src/modules/components/line-days-chart/examples/2/index.ts
index 276834357fda..5f1d6f616677 100644
--- a/projects/demo/src/modules/components/line-days-chart/examples/2/index.ts
+++ b/projects/demo/src/modules/components/line-days-chart/examples/2/index.ts
@@ -82,7 +82,7 @@ export default class Example {
map((months) => [
...Array.from(
{length: TuiMonth.lengthBetween(from, to) + 1},
- (_, i) => months[from.append({month: i}).month],
+ (_, i) => months[from.append({month: i}).month] ?? '',
),
'',
]),
@@ -166,7 +166,7 @@ export default class Example {
this.isE2E
? initial
: Math.max(
- (i ? array[i - 1][1] : initial) +
+ (i ? (array[i - 1]?.[1] ?? 0) : initial) +
Math.random() * 10 -
5,
0,
diff --git a/projects/demo/src/modules/components/line-days-chart/index.ts b/projects/demo/src/modules/components/line-days-chart/index.ts
index 9de8b847b51a..f70d9b03acb9 100644
--- a/projects/demo/src/modules/components/line-days-chart/index.ts
+++ b/projects/demo/src/modules/components/line-days-chart/index.ts
@@ -24,7 +24,7 @@ export default class Page {
.fill(0)
.reduce<
ReadonlyArray<[TuiDay, number]>
- >((array, _, i) => [...array, [new TuiDay(2020, 0, 1).append({day: i}), (i ? array[i - 1][1] : 100) + Math.random() * 20 - 10]], []),
+ >((array, _, i) => [...array, [new TuiDay(2020, 0, 1).append({day: i}), (i ? (array[i - 1]?.[1] ?? 0) : 100) + Math.random() * 20 - 10]], []),
[
[new TuiDay(2020, 1, 10), 10],
[new TuiDay(2020, 1, 15), 150],
@@ -35,10 +35,10 @@ export default class Page {
],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
protected readonly labels$: Observable = this.months$.pipe(
- map((months) => Array.from({length: 4}, (_, i) => months[i])),
+ map((months) => Array.from({length: 4}, (_, i) => months[i] ?? '')),
);
protected readonly yStringifyVariants: ReadonlyArray> = [
diff --git a/projects/demo/src/modules/components/loader/index.ts b/projects/demo/src/modules/components/loader/index.ts
index 4a66807fd1b9..5b03c6679808 100644
--- a/projects/demo/src/modules/components/loader/index.ts
+++ b/projects/demo/src/modules/components/loader/index.ts
@@ -34,7 +34,7 @@ export default class Page {
'xxl',
];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
protected selectedTemplate = '';
diff --git a/projects/demo/src/modules/components/mobile-calendar/index.ts b/projects/demo/src/modules/components/mobile-calendar/index.ts
index 767554bde675..fe24b8617ebe 100644
--- a/projects/demo/src/modules/components/mobile-calendar/index.ts
+++ b/projects/demo/src/modules/components/mobile-calendar/index.ts
@@ -36,7 +36,7 @@ export default class Page {
new TuiDay(1900, 0, 1),
];
- protected min = this.minVariants[0];
+ protected min = this.minVariants[0]!;
protected maxVariants = [
TUI_LAST_DAY,
@@ -44,7 +44,7 @@ export default class Page {
new TuiDay(2300, 0, 1),
];
- protected max = this.maxVariants[0];
+ protected max = this.maxVariants[0]!;
protected single = true;
protected multi = false;
@@ -53,7 +53,7 @@ export default class Page {
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, ({day}) => day % 3 === 0];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
protected control = new FormControl(null);
diff --git a/projects/demo/src/modules/components/multi-select/examples/12/index.ts b/projects/demo/src/modules/components/multi-select/examples/12/index.ts
index b2425ff5708c..37f44e37f080 100644
--- a/projects/demo/src/modules/components/multi-select/examples/12/index.ts
+++ b/projects/demo/src/modules/components/multi-select/examples/12/index.ts
@@ -42,5 +42,8 @@ export default class Example {
public readonly moreOptions: readonly string[] = ['Item #6', 'Item #7', 'Item #8'];
- public value: readonly string[] = [this.mainOptions[2], this.moreOptions[1]];
+ public value: readonly string[] = [
+ this.mainOptions[2] ?? '',
+ this.moreOptions[1] ?? '',
+ ];
}
diff --git a/projects/demo/src/modules/components/multi-select/examples/5/index.ts b/projects/demo/src/modules/components/multi-select/examples/5/index.ts
index 6a2d3f1a2c78..c22162301d81 100644
--- a/projects/demo/src/modules/components/multi-select/examples/5/index.ts
+++ b/projects/demo/src/modules/components/multi-select/examples/5/index.ts
@@ -30,5 +30,5 @@ export default class Example {
protected readonly sith: readonly string[] = ['Emperor', 'Darth Vader', 'Darth Maul'];
- protected value: readonly string[] = [this.jedi[0]];
+ protected value: readonly string[] = [this.jedi[0] ?? ''];
}
diff --git a/projects/demo/src/modules/components/multi-select/examples/6/index.ts b/projects/demo/src/modules/components/multi-select/examples/6/index.ts
index 7ab840abcf43..da1e1163acc7 100644
--- a/projects/demo/src/modules/components/multi-select/examples/6/index.ts
+++ b/projects/demo/src/modules/components/multi-select/examples/6/index.ts
@@ -30,5 +30,5 @@ export default class Example {
'مایکل پیلین',
];
- protected value: readonly string[] = [this.items[0]];
+ protected value: readonly string[] = [this.items[0] ?? ''];
}
diff --git a/projects/demo/src/modules/components/multi-select/index.ts b/projects/demo/src/modules/components/multi-select/index.ts
index 3f1cf5ae2f59..ef21c189a3ca 100644
--- a/projects/demo/src/modules/components/multi-select/index.ts
+++ b/projects/demo/src/modules/components/multi-select/index.ts
@@ -86,14 +86,14 @@ export default class PageComponent extends AbstractExampleTuiControl {
(item) => String(String(item).match(/\d+/)),
];
- protected stringify = this.stringifyVariants[0];
+ protected stringify = this.stringifyVariants[0]!;
protected identityMatcherVariants: ReadonlyArray> = [
(item1, item2) => item1 === item2,
(item1, item2) => item1.balance === item2.balance,
];
- protected identityMatcher = this.identityMatcherVariants[0];
+ protected identityMatcher = this.identityMatcherVariants[0]!;
protected tagValidatorVariants: ReadonlyArray> = [
TUI_TRUE_HANDLER,
@@ -101,7 +101,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
(item) => !item.name.startsWith('Pounds'),
];
- protected tagValidator = this.tagValidatorVariants[0];
+ protected tagValidator = this.tagValidatorVariants[0]!;
protected readonly valueContentVariants: ReadonlyArray<
PolymorpheusContent>
@@ -113,7 +113,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
TuiBooleanHandler
> = [TUI_FALSE_HANDLER, (item: Account) => item.balance < 300];
- protected disabledItemHandler = this.disabledItemHandlerVariants[0];
+ protected disabledItemHandler = this.disabledItemHandlerVariants[0]!;
public control = new FormControl(null);
@@ -126,7 +126,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
];
public override size: TuiSizeL | TuiSizeS =
- this.sizeVariants[this.sizeVariants.length - 1];
+ this.sizeVariants[this.sizeVariants.length - 1]!;
public override readonly maxLengthVariants: readonly number[] = [10];
diff --git a/projects/demo/src/modules/components/pagination/index.ts b/projects/demo/src/modules/components/pagination/index.ts
index 97b94316b788..3a22b245449e 100644
--- a/projects/demo/src/modules/components/pagination/index.ts
+++ b/projects/demo/src/modules/components/pagination/index.ts
@@ -15,7 +15,7 @@ export default class Page {
protected index = 0;
protected length = 8;
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
protected activePadding = 1;
protected sidePadding = 1;
}
diff --git a/projects/demo/src/modules/components/pie-chart/examples/2/index.html b/projects/demo/src/modules/components/pie-chart/examples/2/index.html
index 1916cf78cac3..af54e457b51f 100644
--- a/projects/demo/src/modules/components/pie-chart/examples/2/index.html
+++ b/projects/demo/src/modules/components/pie-chart/examples/2/index.html
@@ -7,6 +7,6 @@
#content
let-index
>
- {{ value[index] | tuiAmount: 'RUB' | async }}
+ {{ value[index] || 0 | tuiAmount: 'RUB' | async }}
{{ labels[index] }}
diff --git a/projects/demo/src/modules/components/pie-chart/index.ts b/projects/demo/src/modules/components/pie-chart/index.ts
index e2ea5ae442ac..d9101bebc956 100644
--- a/projects/demo/src/modules/components/pie-chart/index.ts
+++ b/projects/demo/src/modules/components/pie-chart/index.ts
@@ -25,11 +25,11 @@ export default class Page {
[13769, 12367, 10172, 3018, 2592],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
protected readonly activeItemIndexVariants = [NaN, 0, 1, 2];
- protected activeItemIndex = this.activeItemIndexVariants[0];
+ protected activeItemIndex = this.activeItemIndexVariants[0]!;
protected readonly sizeVariants: ReadonlyArray = [
'xs',
@@ -39,7 +39,7 @@ export default class Page {
'xl',
];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
protected readonly contentVariants: ReadonlyArray<
PolymorpheusContent>
@@ -49,14 +49,14 @@ export default class Page {
({$implicit}) => this.format($implicit),
];
- protected hintContent = this.contentVariants[0];
+ protected hintContent = this.contentVariants[0]!;
protected getPercent(index: number): string {
- return `${tuiRound((100 * this.value[index]) / tuiSum(...this.value), 2)} %`;
+ return `${tuiRound((100 * (this.value[index] ?? 0)) / tuiSum(...this.value), 2)} %`;
}
protected format(index: number): string {
- return `${tuiFormatNumber(this.value[index])} ${tuiGetCurrencySymbol(
+ return `${tuiFormatNumber(this.value[index] ?? 0)} ${tuiGetCurrencySymbol(
TuiCurrency.Ruble,
)}`;
}
diff --git a/projects/demo/src/modules/components/primitive-textfield/index.ts b/projects/demo/src/modules/components/primitive-textfield/index.ts
index 42fe2afd4771..7ca0a22a6c38 100644
--- a/projects/demo/src/modules/components/primitive-textfield/index.ts
+++ b/projects/demo/src/modules/components/primitive-textfield/index.ts
@@ -51,10 +51,10 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected readonly routes = DemoRoute;
protected readonly themes = ['Taiga UI', 'Bootstrap', 'Material'];
- protected theme = this.themes[0];
+ protected theme = this.themes[0]!;
protected readonly iconVariants = ['', '@tui.search', 'Interactive content'];
- protected selectedIcon = this.iconVariants[0];
+ protected selectedIcon = this.iconVariants[0]!;
protected readonly iconLeftVariants = ['', '@tui.pie-chart', '@tui.credit-card'];
@@ -84,7 +84,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected readonly inputModeVariants: readonly string[] = ['text', 'numeric'];
- protected inputMode = this.inputModeVariants[0];
+ protected inputMode = this.inputModeVariants[0]!;
protected readonly customContentVariants = [
'',
@@ -92,7 +92,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
'LongTextContent',
];
- protected customContentSelected = this.customContentVariants[0];
+ protected customContentSelected = this.customContentVariants[0]!;
protected password = '';
@@ -110,7 +110,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
protected readonly hintContentVariants: readonly string[] = ['', 'Ivan Ivanov'];
@@ -120,11 +120,11 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected invalid = false;
- protected hintContent = this.hintContentVariants[0];
+ protected hintContent = this.hintContentVariants[0]!;
- protected hintDirection = this.hintDirectionVariants[0];
+ protected hintDirection = this.hintDirectionVariants[0]!;
- protected hintAppearance = this.hintAppearanceVariants[0];
+ protected hintAppearance = this.hintAppearanceVariants[0]!;
protected get customContent(): string | null {
return this.customContentSelected;
@@ -145,7 +145,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
}
protected get isMaterial(): boolean {
- return this.theme === this.themes[2];
+ return this.theme === this.themes[2]!;
}
protected get placeholder(): string {
diff --git a/projects/demo/src/modules/components/progress-bar/index.ts b/projects/demo/src/modules/components/progress-bar/index.ts
index f693bccb33c5..146e1c6c479e 100644
--- a/projects/demo/src/modules/components/progress-bar/index.ts
+++ b/projects/demo/src/modules/components/progress-bar/index.ts
@@ -25,7 +25,7 @@ export default class Page {
'xxl',
];
- protected size: TuiSizeXS | TuiSizeXXL = this.sizeVariants[2];
+ protected size: TuiSizeXS | TuiSizeXXL = this.sizeVariants[2]!;
protected readonly colorVariants: readonly string[] = [
'var(--tui-background-accent-1)',
@@ -35,5 +35,5 @@ export default class Page {
'linear-gradient(to right, var(--tui-chart-categorical-02), var(--tui-chart-categorical-14), var(--tui-chart-categorical-12))',
];
- protected color = this.colorVariants[0];
+ protected color = this.colorVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/progress-circle/index.ts b/projects/demo/src/modules/components/progress-circle/index.ts
index 5f79a76985e7..7ad00010bb7b 100644
--- a/projects/demo/src/modules/components/progress-circle/index.ts
+++ b/projects/demo/src/modules/components/progress-circle/index.ts
@@ -38,5 +38,5 @@ export default class Page {
'url(#gradient)',
];
- protected color = this.colorVariants[0];
+ protected color = this.colorVariants[0]!;
}
diff --git a/projects/demo/src/modules/components/push/index.ts b/projects/demo/src/modules/components/push/index.ts
index b2f1a7ba3fbc..9f9ac54a33a9 100644
--- a/projects/demo/src/modules/components/push/index.ts
+++ b/projects/demo/src/modules/components/push/index.ts
@@ -18,6 +18,6 @@ export default class Page {
protected type = '';
protected readonly timestampVars = ['', 'A moment ago', 123456789];
- protected timestamp = this.timestampVars[0];
+ protected timestamp = this.timestampVars[0]!;
protected readonly routes = DemoRoute;
}
diff --git a/projects/demo/src/modules/components/radio/examples/3/index.ts b/projects/demo/src/modules/components/radio/examples/3/index.ts
index 06752c35e4a6..43541ea13ebd 100644
--- a/projects/demo/src/modules/components/radio/examples/3/index.ts
+++ b/projects/demo/src/modules/components/radio/examples/3/index.ts
@@ -41,8 +41,8 @@ export default class Example {
protected readonly strings = ['King Arthur', "It's Man", 'Silly Walks'];
- protected horizontal = this.strings[0];
+ protected horizontal = this.strings[0]!;
protected readonly handler: TuiBooleanHandler = (item) =>
- item === this.strings[2];
+ item === this.strings[2]!;
}
diff --git a/projects/demo/src/modules/components/range/index.ts b/projects/demo/src/modules/components/range/index.ts
index 38ee74fe34c4..9829c69469de 100644
--- a/projects/demo/src/modules/components/range/index.ts
+++ b/projects/demo/src/modules/components/range/index.ts
@@ -17,7 +17,7 @@ export default class Page {
protected readonly sizeVariants: readonly TuiSizeS[] = ['s', 'm'];
- protected size: TuiSizeS = this.sizeVariants[1];
+ protected size: TuiSizeS = this.sizeVariants[1]!;
protected min = 0;
diff --git a/projects/demo/src/modules/components/ring-chart/examples/2/index.ts b/projects/demo/src/modules/components/ring-chart/examples/2/index.ts
index 095cf1652278..6ac9e7442647 100644
--- a/projects/demo/src/modules/components/ring-chart/examples/2/index.ts
+++ b/projects/demo/src/modules/components/ring-chart/examples/2/index.ts
@@ -22,10 +22,10 @@ export default class Example {
protected index = NaN;
protected get sum(): number {
- return Number.isNaN(this.index) ? this.total : this.value[this.index];
+ return (Number.isNaN(this.index) ? this.total : this.value[this.index]) ?? 0;
}
protected get label(): string {
- return Number.isNaN(this.index) ? 'Total' : this.labels[this.index];
+ return (Number.isNaN(this.index) ? 'Total' : this.labels[this.index]) ?? '';
}
}
diff --git a/projects/demo/src/modules/components/ring-chart/index.ts b/projects/demo/src/modules/components/ring-chart/index.ts
index d744ad7ad620..085f0c7a8a0b 100644
--- a/projects/demo/src/modules/components/ring-chart/index.ts
+++ b/projects/demo/src/modules/components/ring-chart/index.ts
@@ -17,11 +17,11 @@ export default class Page {
[13769, 10172, 3018, 2592],
];
- protected value = this.valueVariants[0];
+ protected value = this.valueVariants[0]!;
protected readonly activeItemIndexVariants = [NaN, 0, 1, 2];
- protected activeItemIndex = this.activeItemIndexVariants[0];
+ protected activeItemIndex = this.activeItemIndexVariants[0]!;
protected readonly sizeVariants: ReadonlyArray = [
'xs',
@@ -31,5 +31,5 @@ export default class Page {
'xl',
];
- protected size = this.sizeVariants[2];
+ protected size = this.sizeVariants[2]!;
}
diff --git a/projects/demo/src/modules/components/select/examples/4/index.ts b/projects/demo/src/modules/components/select/examples/4/index.ts
index a5c91044f558..134e44c0d35f 100644
--- a/projects/demo/src/modules/components/select/examples/4/index.ts
+++ b/projects/demo/src/modules/components/select/examples/4/index.ts
@@ -23,7 +23,7 @@ export default class Example {
...inject('Pythons' as any),
];
- protected value = this.pythons[0];
+ protected value = this.pythons[0]!;
protected addMore(select: TuiSelectComponent): void {
select.handleOption(select.value);
diff --git a/projects/demo/src/modules/components/select/index.ts b/projects/demo/src/modules/components/select/index.ts
index 8e590333a372..e2ec914c20e0 100644
--- a/projects/demo/src/modules/components/select/index.ts
+++ b/projects/demo/src/modules/components/select/index.ts
@@ -68,7 +68,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
protected readonly valueTemplateVariants = ['', 'Template'];
- protected selectedValueTemplate = this.valueTemplateVariants[0];
+ protected selectedValueTemplate = this.valueTemplateVariants[0]!;
protected readonly identityMatcherVariants: ReadonlyArray<
TuiIdentityMatcher
@@ -77,7 +77,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
(item1, item2) => item1.balance === item2.balance,
];
- protected identityMatcher = this.identityMatcherVariants[0];
+ protected identityMatcher = this.identityMatcherVariants[0]!;
protected readonly disabledItemHandlerVariants: ReadonlyArray<
TuiBooleanHandler
@@ -85,7 +85,7 @@ export default class PageComponent extends AbstractExampleTuiControl {
public readonly iconVariants = ['', '@tui.pie-chart', '@tui.credit-card'];
- public override iconStart = this.iconVariants[0];
+ public override iconStart = this.iconVariants[0]!;
public control = new FormControl(null, Validators.required);
diff --git a/projects/demo/src/modules/components/sheet/examples/6/index.html b/projects/demo/src/modules/components/sheet/examples/6/index.html
index 050759a1d548..cd67aacf4443 100644
--- a/projects/demo/src/modules/components/sheet/examples/6/index.html
+++ b/projects/demo/src/modules/components/sheet/examples/6/index.html
@@ -19,7 +19,7 @@
alt=""
class="image"
[src]="image"
- (waIntersectionObservee)="onIntersection($event, img)"
+ (waIntersectionObservee)="$event[0] && onIntersection($event[0], img)"
/>
diff --git a/projects/demo/src/modules/components/sheet/examples/6/index.ts b/projects/demo/src/modules/components/sheet/examples/6/index.ts
index df847c0462fc..11ddce0e4445 100644
--- a/projects/demo/src/modules/components/sheet/examples/6/index.ts
+++ b/projects/demo/src/modules/components/sheet/examples/6/index.ts
@@ -36,7 +36,7 @@ export default class Example {
}
protected onIntersection(
- [{isIntersecting}]: IntersectionObserverEntry[],
+ {isIntersecting}: IntersectionObserverEntry,
{classList}: HTMLElement,
): void {
classList.toggle('_visible', isIntersecting);
diff --git a/projects/demo/src/modules/components/slider/index.ts b/projects/demo/src/modules/components/slider/index.ts
index e778adbd8a70..2407974fd5f6 100644
--- a/projects/demo/src/modules/components/slider/index.ts
+++ b/projects/demo/src/modules/components/slider/index.ts
@@ -17,7 +17,7 @@ export default class Page {
protected max = 5;
protected min = 0;
protected step = 1;
- protected size: TuiSizeS = this.sizeVariants[1];
+ protected size: TuiSizeS = this.sizeVariants[1]!;
protected segments = this.max;
protected get disabled(): boolean {
diff --git a/projects/demo/src/modules/components/stepper/index.ts b/projects/demo/src/modules/components/stepper/index.ts
index 84f9b47ba82e..d613a0c61e07 100644
--- a/projects/demo/src/modules/components/stepper/index.ts
+++ b/projects/demo/src/modules/components/stepper/index.ts
@@ -25,11 +25,11 @@ export default class Page {
'vertical',
];
- protected orientation: TuiOrientation = this.orientationVariants[0];
+ protected orientation: TuiOrientation = this.orientationVariants[0]!;
protected readonly iconVariants = ['', '@tui.clock', '@tui.heart'];
- protected icon = this.iconVariants[0];
+ protected icon = this.iconVariants[0]!;
protected readonly stateVariants = ['normal', 'pass', 'error'] as const;
diff --git a/projects/demo/src/modules/components/table-pagination/index.ts b/projects/demo/src/modules/components/table-pagination/index.ts
index 64f435830eee..358bcae20497 100644
--- a/projects/demo/src/modules/components/table-pagination/index.ts
+++ b/projects/demo/src/modules/components/table-pagination/index.ts
@@ -20,8 +20,8 @@ export default class Page {
protected total = 1000;
protected page = 5;
- protected items = this.itemsVariants[0];
- protected size = this.items[0];
+ protected items = this.itemsVariants[0]!;
+ protected size = this.items[0]!;
protected update({page, size}: TuiTablePaginationEvent): void {
this.page = page;
diff --git a/projects/demo/src/modules/components/table/examples/3/index.ts b/projects/demo/src/modules/components/table/examples/3/index.ts
index 0c7ef318b79f..4f12ca4700f8 100644
--- a/projects/demo/src/modules/components/table/examples/3/index.ts
+++ b/projects/demo/src/modules/components/table/examples/3/index.ts
@@ -60,21 +60,21 @@ export default class Example {
name: 'Holy Grail',
price: 999999,
quantity: 1,
- unit: this.units[0],
+ unit: this.units[0] ?? '',
date: TuiDay.currentLocal(),
},
{
name: 'Foot',
price: 29.95,
quantity: 5,
- unit: this.units[2],
+ unit: this.units[2] ?? '',
date: TuiDay.currentLocal().append({day: -42}),
},
{
name: 'Shed',
price: 499,
quantity: 2,
- unit: this.units[0],
+ unit: this.units[0] ?? '',
date: TuiDay.currentLocal().append({day: -237}),
},
];
@@ -84,21 +84,21 @@ export default class Example {
name: 'Lightsaber',
price: 4999,
quantity: 3,
- unit: this.units[0],
+ unit: this.units[0] ?? '',
date: TuiDay.currentLocal(),
},
{
name: 'Spaceship',
price: 19999,
quantity: 1,
- unit: this.units[0],
+ unit: this.units[0] ?? '',
date: TuiDay.currentLocal().append({day: -237}),
},
{
name: 'Stormtrooper helmet',
price: 14.95,
quantity: 5,
- unit: this.units[0],
+ unit: this.units[0] ?? '',
date: TuiDay.currentLocal().append({day: -42}),
},
];
diff --git a/projects/demo/src/modules/components/table/examples/4/index.ts b/projects/demo/src/modules/components/table/examples/4/index.ts
index c6ecea474350..3b7ac145844a 100644
--- a/projects/demo/src/modules/components/table/examples/4/index.ts
+++ b/projects/demo/src/modules/components/table/examples/4/index.ts
@@ -174,7 +174,7 @@ export default class Example {
this.enabled = enabled;
this.columns = this.initial
.filter((column) => enabled.includes(column))
- .map((column) => KEYS[column]);
+ .map((column) => KEYS[column] ?? '');
}
protected onDirection(direction: -1 | 1): void {
diff --git a/projects/demo/src/modules/components/table/examples/6/index.ts b/projects/demo/src/modules/components/table/examples/6/index.ts
index be3e3ad9b607..123f3ae18731 100644
--- a/projects/demo/src/modules/components/table/examples/6/index.ts
+++ b/projects/demo/src/modules/components/table/examples/6/index.ts
@@ -18,7 +18,7 @@ export default class Example {
protected data: Array> = [{id: 1, name: 'name'}];
protected get columns(): string[] {
- return Object.keys(this.data[0]);
+ return Object.keys(this.data[0] ?? {});
}
protected addColumn(): void {
diff --git a/projects/demo/src/modules/components/tabs/index.ts b/projects/demo/src/modules/components/tabs/index.ts
index 1a5402dab04e..1908fba11e99 100644
--- a/projects/demo/src/modules/components/tabs/index.ts
+++ b/projects/demo/src/modules/components/tabs/index.ts
@@ -17,7 +17,7 @@ export default class Page {
protected readonly moreContentVariants = ['', 'And more'];
- protected moreContent = this.moreContentVariants[0];
+ protected moreContent = this.moreContentVariants[0]!;
protected underline = true;
@@ -27,5 +27,5 @@ export default class Page {
protected sizes: readonly TuiSizeL[] = ['m', 'l'];
- protected size = this.sizes[1];
+ protected size = this.sizes[1]!;
}
diff --git a/projects/demo/src/modules/components/tag/index.ts b/projects/demo/src/modules/components/tag/index.ts
index 4ba9e77efc73..d62da6ddc1af 100644
--- a/projects/demo/src/modules/components/tag/index.ts
+++ b/projects/demo/src/modules/components/tag/index.ts
@@ -47,11 +47,11 @@ export default class Page {
'warning',
];
- protected status = this.statusVariants[0];
+ protected status = this.statusVariants[0]!;
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size: TuiSizeL | TuiSizeS = this.sizeVariants[1];
+ protected size: TuiSizeL | TuiSizeS = this.sizeVariants[1]!;
protected readonly leftContentVariants = ['', 'Error icon'];
diff --git a/projects/demo/src/modules/components/textarea/index.ts b/projects/demo/src/modules/components/textarea/index.ts
index 3fda953fe63e..14fcbe3cf0f2 100644
--- a/projects/demo/src/modules/components/textarea/index.ts
+++ b/projects/demo/src/modules/components/textarea/index.ts
@@ -37,9 +37,9 @@ import {InheritedDocumentation} from '../abstract/inherited-documentation';
export default class PageComponent extends AbstractExampleTuiControl {
protected readonly routes = DemoRoute;
protected readonly iconVariants = ['', '@tui.search', '@tui.calendar'];
- protected icon = this.iconVariants[0];
+ protected icon = this.iconVariants[0]!;
protected readonly rowsVariants: readonly number[] = [8, 15, 30];
- protected rows: number = this.rowsVariants[0];
+ protected rows: number = this.rowsVariants[0]!;
protected expandable = false;
protected placeholder = 'Placeholder';
@@ -52,5 +52,5 @@ export default class PageComponent extends AbstractExampleTuiControl {
'l',
];
- public override size: TuiSizeL | TuiSizeM = this.sizeVariants[1];
+ public override size: TuiSizeL | TuiSizeM = this.sizeVariants[1]!;
}
diff --git a/projects/demo/src/modules/components/thumbnail-card/index.ts b/projects/demo/src/modules/components/thumbnail-card/index.ts
index 1d8b2ed89d38..c32710c9d020 100644
--- a/projects/demo/src/modules/components/thumbnail-card/index.ts
+++ b/projects/demo/src/modules/components/thumbnail-card/index.ts
@@ -16,8 +16,8 @@ import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core';
export default class Example {
protected readonly examples = ['Sizes', 'A cool one', 'Backgrounds'];
protected readonly iconVariants = ['', '@tui.lock', '@tui.cloud', '@tui.user'];
- protected iconStart = this.iconVariants[0];
- protected iconEnd = this.iconVariants[0];
+ protected iconStart = this.iconVariants[0]!;
+ protected iconEnd = this.iconVariants[0]!;
protected readonly paymentSystemVariants: readonly TuiPaymentSystem[] = [
'amex',
@@ -37,13 +37,13 @@ export default class Example {
];
protected readonly sizeVariants: ReadonlyArray = ['s', 'm', 'l'];
- protected size = this.sizeVariants[1];
+ protected size = this.sizeVariants[1]!;
protected readonly monoHandlerVariants: ReadonlyArray<
TuiBooleanHandler
> = [(ps) => ps === 'mir' || ps === 'visa' || ps === 'electron', TUI_TRUE_HANDLER];
- protected monoHandler = this.monoHandlerVariants[0];
+ protected monoHandler = this.monoHandlerVariants[0]!;
protected paymentSystem: TuiPaymentSystem | null = null;
}
diff --git a/projects/demo/src/modules/components/tree/examples/4/index.ts b/projects/demo/src/modules/components/tree/examples/4/index.ts
index c609727ff628..d55f5f8ae8d3 100644
--- a/projects/demo/src/modules/components/tree/examples/4/index.ts
+++ b/projects/demo/src/modules/components/tree/examples/4/index.ts
@@ -54,7 +54,10 @@ export default class Example {
protected toggleLevel(index: number): void {
const nodes: readonly TreeNode[] = this.data.children || [];
+ const key = nodes[index];
- this.map.set(nodes[index], !this.map.get(nodes[index]));
+ if (key) {
+ this.map.set(key, !this.map.get(key));
+ }
}
}
diff --git a/projects/demo/src/modules/components/tree/examples/6/index.ts b/projects/demo/src/modules/components/tree/examples/6/index.ts
index 9c74749f7050..887ea64acd9b 100644
--- a/projects/demo/src/modules/components/tree/examples/6/index.ts
+++ b/projects/demo/src/modules/components/tree/examples/6/index.ts
@@ -60,8 +60,13 @@ export default class Example {
item: TreeNode,
map: Map,
): boolean | null => {
+ let result: boolean | null = null;
const flat = flatten(item);
- const result = !!map.get(flat[0]);
+ const key = flat[0]!;
+
+ if (key) {
+ result = !!map.get(key);
+ }
for (const item of flat) {
if (result !== !!map.get(item)) {
diff --git a/projects/demo/src/modules/directives/appearance/index.ts b/projects/demo/src/modules/directives/appearance/index.ts
index d35bdfa42cb4..1cbb099e0d24 100644
--- a/projects/demo/src/modules/directives/appearance/index.ts
+++ b/projects/demo/src/modules/directives/appearance/index.ts
@@ -12,7 +12,7 @@ import {TuiButton} from '@taiga-ui/core';
})
export default class Page {
protected appearances = ['primary', 'secondary', 'flat'];
- protected appearance = this.appearances[0];
+ protected appearance = this.appearances[0]!;
protected states: readonly TuiInteractiveState[] = ['hover', 'active', 'disabled'];
protected state: TuiInteractiveState | null = null;
diff --git a/projects/demo/src/modules/directives/dropdown-open/examples/3/index.ts b/projects/demo/src/modules/directives/dropdown-open/examples/3/index.ts
index a468044311ee..4e2f50b999bd 100644
--- a/projects/demo/src/modules/directives/dropdown-open/examples/3/index.ts
+++ b/projects/demo/src/modules/directives/dropdown-open/examples/3/index.ts
@@ -26,20 +26,20 @@ export default class Example {
protected ascending = false;
protected onClick(item: string): void {
- if (this.items[0].includes(item)) {
+ if (this.items[0]?.includes(item)) {
this.primary = item;
return;
}
- this.ascending = item === this.items[1][0];
+ this.ascending = item === this.items[1]?.[0];
}
protected itemIsActive(item: string): boolean {
return (
item === this.primary ||
- (this.ascending && item === this.items[1][0]) ||
- (!this.ascending && item === this.items[1][1])
+ (this.ascending && item === this.items[1]?.[0]) ||
+ (!this.ascending && item === this.items[1]?.[1])
);
}
}
diff --git a/projects/demo/src/modules/directives/dropdown-open/examples/4/index.ts b/projects/demo/src/modules/directives/dropdown-open/examples/4/index.ts
index 487d8d6f2e3b..890b6e6560d3 100644
--- a/projects/demo/src/modules/directives/dropdown-open/examples/4/index.ts
+++ b/projects/demo/src/modules/directives/dropdown-open/examples/4/index.ts
@@ -38,7 +38,7 @@ export default class Example {
case 0:
return 'Select';
case 1:
- return this.value[0];
+ return this.value[0] ?? '';
default:
return `${this.length} selected`;
}
diff --git a/projects/demo/src/modules/directives/dropdown-open/index.ts b/projects/demo/src/modules/directives/dropdown-open/index.ts
index 5b56dce68c65..37fc969ed4c5 100644
--- a/projects/demo/src/modules/directives/dropdown-open/index.ts
+++ b/projects/demo/src/modules/directives/dropdown-open/index.ts
@@ -38,11 +38,11 @@ export default class PageComponent extends AbstractExampleTuiDropdown {
protected enabledVariants = [true, 'getter this.input.length > 2'];
- protected enabledSelected = this.enabledVariants[0];
+ protected enabledSelected = this.enabledVariants[0]!;
protected readonly contentVariants = ['Template', 'Custom string'];
- protected content = this.contentVariants[0];
+ protected content = this.contentVariants[0]!;
protected get template(): boolean {
return this.content === 'Template';
diff --git a/projects/demo/src/modules/directives/fluid-typography/examples/3/index.ts b/projects/demo/src/modules/directives/fluid-typography/examples/3/index.ts
index 880793680d45..8cd89e07bb60 100644
--- a/projects/demo/src/modules/directives/fluid-typography/examples/3/index.ts
+++ b/projects/demo/src/modules/directives/fluid-typography/examples/3/index.ts
@@ -19,7 +19,7 @@ export default class Example {
protected value = 'I am a very long value';
protected range = signal([this.options.min * 16, this.options.max * 16]);
protected scale = computed<[number, number]>(() => [
- this.range()[0] / 16,
- this.range()[1] / 16,
+ (this.range()[0] ?? 0) / 16,
+ (this.range()[1] ?? 0) / 16,
]);
}
diff --git a/projects/demo/src/modules/directives/media/index.ts b/projects/demo/src/modules/directives/media/index.ts
index 6729392916db..6493dca2b46b 100644
--- a/projects/demo/src/modules/directives/media/index.ts
+++ b/projects/demo/src/modules/directives/media/index.ts
@@ -14,6 +14,6 @@ export default class Page {
protected playbackRate = 1;
protected currentTime = 0;
- protected volume = this.volumeVariants[0];
+ protected volume = this.volumeVariants[0]!;
protected paused = true;
}
diff --git a/projects/demo/src/modules/directives/pan/examples/1/index.ts b/projects/demo/src/modules/directives/pan/examples/1/index.ts
index 9a4ebec5e270..a62c6e7f4800 100644
--- a/projects/demo/src/modules/directives/pan/examples/1/index.ts
+++ b/projects/demo/src/modules/directives/pan/examples/1/index.ts
@@ -33,8 +33,8 @@ export default class Example {
protected onPan(delta: readonly [number, number]): void {
this.coordinates$.next([
- this.currentCoords[0] + delta[0],
- this.currentCoords[1] + delta[1],
+ (this.currentCoords[0] ?? 0) + delta[0],
+ (this.currentCoords[1] ?? 0) + delta[1],
]);
}
}
diff --git a/projects/demo/src/modules/directives/progress-segmented/index.ts b/projects/demo/src/modules/directives/progress-segmented/index.ts
index ab69614c6aa8..e32f6ba56c01 100644
--- a/projects/demo/src/modules/directives/progress-segmented/index.ts
+++ b/projects/demo/src/modules/directives/progress-segmented/index.ts
@@ -29,7 +29,7 @@ export default class Page {
'xxl',
];
- protected size: TuiProgressBar['size'] = this.sizeVariants[2];
+ protected size: TuiProgressBar['size'] = this.sizeVariants[2]!;
protected readonly colorsVariants: readonly string[][] = [
['var(--tui-background-accent-1)'],
@@ -39,7 +39,7 @@ export default class Page {
.map((_, index) => `var(--tui-chart-categorical-0${index + 1})`),
];
- protected colors: string[] = this.colorsVariants[0];
+ protected colors: string[] = this.colorsVariants[0] ?? [];
protected get computedColors(): string[] {
return this.colors.slice(0, this.segments);
diff --git a/projects/demo/src/modules/directives/textfield-controller/index.ts b/projects/demo/src/modules/directives/textfield-controller/index.ts
index 2ad74d4fbc3b..ce2700d24b0b 100644
--- a/projects/demo/src/modules/directives/textfield-controller/index.ts
+++ b/projects/demo/src/modules/directives/textfield-controller/index.ts
@@ -34,17 +34,17 @@ export default class Page {
'url',
];
- protected type = this.typeVariants[0];
+ protected type = this.typeVariants[0]!;
protected readonly customContentVariants = ['', 'Bell'];
- protected customContentSelected = this.customContentVariants[0];
+ protected customContentSelected = this.customContentVariants[0]!;
protected cleaner = false;
protected exampleText = '';
protected labelOutside = false;
- protected size = this.sizeVariants[2];
- protected inputMode = this.inputModeVariants[0];
+ protected size = this.sizeVariants[2]!;
+ protected inputMode = this.inputModeVariants[0]!;
protected maxLength: number | null = null;
protected readonly control = new FormControl('111', Validators.required);
diff --git a/projects/demo/src/modules/directives/validator/examples/1/index.html b/projects/demo/src/modules/directives/validator/examples/1/index.html
index f23069c15292..af21fc6983ae 100644
--- a/projects/demo/src/modules/directives/validator/examples/1/index.html
+++ b/projects/demo/src/modules/directives/validator/examples/1/index.html
@@ -12,7 +12,7 @@
/>
diff --git a/projects/demo/src/modules/directives/validator/examples/1/index.ts b/projects/demo/src/modules/directives/validator/examples/1/index.ts
index bacfa23d261d..97cad387ee32 100644
--- a/projects/demo/src/modules/directives/validator/examples/1/index.ts
+++ b/projects/demo/src/modules/directives/validator/examples/1/index.ts
@@ -32,7 +32,7 @@ import {TuiInputModule, TuiInputPhoneModule, TuiSelectModule} from '@taiga-ui/le
export default class Example {
protected readonly items = ['Email', 'Phone'];
- protected type = this.items[0];
+ protected type = this.items[0]!;
protected readonly group = new FormGroup({
name: new FormControl('', Validators.required),
diff --git a/projects/demo/src/modules/markup/breakpoints/index.ts b/projects/demo/src/modules/markup/breakpoints/index.ts
index bdae8a0ec05f..6e166a95f4bc 100644
--- a/projects/demo/src/modules/markup/breakpoints/index.ts
+++ b/projects/demo/src/modules/markup/breakpoints/index.ts
@@ -24,7 +24,7 @@ function parseBreakpoints(file: string): Array<{name: string; value: string}> {
.map((line) => line.trim())
.filter(Boolean)
.map((line) => {
- const [name, ...value] = line.split(':');
+ const [name = '', ...value] = line.split(':');
return {name, value: value.join(':').replaceAll(/[~'"]/g, '').trim()};
});
@@ -40,7 +40,7 @@ function parseBreakpoints(file: string): Array<{name: string; value: string}> {
})
export default class Page {
protected readonly breakpoints = parseBreakpoints(fileWithBreakpoints);
- protected readonly columnsNames = Object.keys(this.breakpoints[0]);
+ protected readonly columnsNames = Object.keys(this.breakpoints[0]!);
protected readonly importTaigaUILocalLess = import(
'./examples/import/import-taiga-ui-local-less.md?raw'
diff --git a/projects/demo/src/modules/pipes/currency/index.html b/projects/demo/src/modules/pipes/currency/index.html
index 14779873337d..d7c8a1c83d3f 100644
--- a/projects/demo/src/modules/pipes/currency/index.html
+++ b/projects/demo/src/modules/pipes/currency/index.html
@@ -32,7 +32,7 @@
Type a sum
diff --git a/projects/demo/src/modules/pipes/field-error/examples/4/index.ts b/projects/demo/src/modules/pipes/field-error/examples/4/index.ts
index 8e1937bbe0ac..0e19224d2a2e 100644
--- a/projects/demo/src/modules/pipes/field-error/examples/4/index.ts
+++ b/projects/demo/src/modules/pipes/field-error/examples/4/index.ts
@@ -59,7 +59,7 @@ export default class Example {
let n = 0;
while (n <= 1 && this.formData.controls[n]) {
- this.formData.controls[n].setValidators([
+ this.formData.controls[n]?.setValidators([
Validators.required,
this.getPhoneLengthValidator(),
]);
diff --git a/projects/demo/src/modules/pipes/field-error/examples/5/index.ts b/projects/demo/src/modules/pipes/field-error/examples/5/index.ts
index 96b497074444..8b41718540a6 100644
--- a/projects/demo/src/modules/pipes/field-error/examples/5/index.ts
+++ b/projects/demo/src/modules/pipes/field-error/examples/5/index.ts
@@ -45,9 +45,10 @@ export default class Example {
text: ['русский текст', Validators.required],
});
- this.form.controls['text'].setAsyncValidators(
+ this.form.controls['text']?.setAsyncValidators(
asyncValidatorFn(inject(TUI_IS_E2E)),
);
- this.form.controls['text'].markAsTouched();
+
+ this.form.controls['text']?.markAsTouched();
}
}
diff --git a/projects/demo/src/modules/pipes/field-error/examples/6/index.html b/projects/demo/src/modules/pipes/field-error/examples/6/index.html
index a8bdb55e7453..492fb1637202 100644
--- a/projects/demo/src/modules/pipes/field-error/examples/6/index.html
+++ b/projects/demo/src/modules/pipes/field-error/examples/6/index.html
@@ -34,7 +34,7 @@
>
diff --git a/projects/kit/components/accordion/test/accordion.component.spec.ts b/projects/kit/components/accordion/test/accordion.component.spec.ts
index 8e6d7e29975f..dff27257baa0 100644
--- a/projects/kit/components/accordion/test/accordion.component.spec.ts
+++ b/projects/kit/components/accordion/test/accordion.component.spec.ts
@@ -186,10 +186,10 @@ describe('Accordion', () => {
TuiAccordionItemHarness,
);
- await accordionItem1.clickHeader();
+ await accordionItem1?.clickHeader();
- expect(await accordionItem1.getContent()).not.toBeNull();
- expect(await accordionItem2.getContent()).toBeNull();
+ expect(await accordionItem1?.getContent()).not.toBeNull();
+ expect(await accordionItem2?.getContent()).toBeNull();
});
it('clicking on the 2nd section opens its contents and closes the contents of the 1st', async () => {
@@ -198,12 +198,12 @@ describe('Accordion', () => {
);
await parallel(() => [
- accordionItem1.clickHeader(),
- accordionItem2.clickHeader(),
+ accordionItem1?.clickHeader(),
+ accordionItem2?.clickHeader(),
]);
- expect(await accordionItem1.getContent()).toBeNull();
- expect(await accordionItem2.getContent()).not.toBeNull();
+ expect(await accordionItem1?.getContent()).toBeNull();
+ expect(await accordionItem2?.getContent()).not.toBeNull();
});
it('when closeOthers = false, already open sections are not closed when new ones are opened', async () => {
@@ -214,12 +214,12 @@ describe('Accordion', () => {
);
await parallel(() => [
- accordionItem1.clickHeader(),
- accordionItem2.clickHeader(),
+ accordionItem1?.clickHeader(),
+ accordionItem2?.clickHeader(),
]);
- expect(await accordionItem1.getContent()).not.toBeNull();
- expect(await accordionItem2.getContent()).not.toBeNull();
+ expect(await accordionItem1?.getContent()).not.toBeNull();
+ expect(await accordionItem2?.getContent()).not.toBeNull();
});
it.skip('pressing the space bar in the input does not close the accordion', async () => {
diff --git a/projects/kit/components/calendar-range/test/calendar-range.component.spec.ts b/projects/kit/components/calendar-range/test/calendar-range.component.spec.ts
index 99ab8e5d3763..810bcb8bc093 100644
--- a/projects/kit/components/calendar-range/test/calendar-range.component.spec.ts
+++ b/projects/kit/components/calendar-range/test/calendar-range.component.spec.ts
@@ -119,15 +119,15 @@ describe('rangeCalendarComponent', () => {
const items = getItems();
- expect(items[1].nativeElement.contains(getCheckmark())).toBe(true);
+ expect(items[1]?.nativeElement.contains(getCheckmark())).toBe(true);
});
it('if the value does not fit any range, check the box next to "Other date..."', () => {
- expect(getItems()[6].nativeElement.contains(getCheckmark())).toBe(true);
+ expect(getItems()[6]?.nativeElement.contains(getCheckmark())).toBe(true);
});
it('if the value does not fit the range, the range has no tick', () => {
- expect(getItems()[5].nativeElement.contains(getCheckmark())).toBe(false);
+ expect(getItems()[5]?.nativeElement.contains(getCheckmark())).toBe(false);
});
it('interval selection takes into account min / max', () => {
@@ -139,7 +139,10 @@ describe('rangeCalendarComponent', () => {
testComponent.min = min;
fixture.detectChanges();
- component['onItemSelect'](component.items[5]);
+ if (component.items[5]) {
+ component['onItemSelect'](component.items[5]);
+ }
+
fixture.detectChanges();
expect(
@@ -180,8 +183,8 @@ describe('rangeCalendarComponent', () => {
const items = getItems();
expect(items.length).toBe(2);
- expect(items[0].nativeElement.textContent.trim()).toBe(title);
- expect(items[1].nativeElement.textContent.trim()).toBe('Other date...');
+ expect(items[0]?.nativeElement.textContent.trim()).toBe(title);
+ expect(items[1]?.nativeElement.textContent.trim()).toBe('Other date...');
});
it('when redefining intervals, displays appropriate checkbox', () => {
@@ -189,7 +192,10 @@ describe('rangeCalendarComponent', () => {
const previousMonth = today.append({month: -1});
const title = 'New interval';
- component['onItemSelect'](component.items[0]);
+ if (component.items[0]) {
+ component['onItemSelect'](component.items[0]);
+ }
+
fixture.detectChanges();
testComponent.items = [
@@ -200,10 +206,9 @@ describe('rangeCalendarComponent', () => {
const items = getItems();
- expect(items[0].nativeElement.textContent.trim()).toBe(title);
-
- expect(items[0].nativeElement.contains(getCheckmark())).toBe(false);
- expect(items[1].nativeElement.contains(getCheckmark())).toBe(true);
+ expect(items[0]?.nativeElement.textContent.trim()).toBe(title);
+ expect(items[0]?.nativeElement.contains(getCheckmark())).toBe(false);
+ expect(items[1]?.nativeElement.contains(getCheckmark())).toBe(true);
});
it('if there are ranges with same range dates, displays appropriate checkbox when switching between them', () => {
@@ -214,19 +219,25 @@ describe('rangeCalendarComponent', () => {
new TuiDayRangePeriod(new TuiDayRange(previousMonth, today), '1'),
new TuiDayRangePeriod(new TuiDayRange(previousMonth, today), '2'),
];
+
fixture.detectChanges();
- component['onItemSelect'](component.items[1]);
+ if (component.items[1]) {
+ component['onItemSelect'](component.items[1]);
+ }
+
fixture.detectChanges();
const items = getItems();
- expect(items[0].nativeElement.contains(getCheckmark())).toBe(false);
- expect(items[1].nativeElement.contains(getCheckmark())).toBe(true);
+ expect(items[0]?.nativeElement.contains(getCheckmark())).toBe(false);
+ expect(items[1]?.nativeElement.contains(getCheckmark())).toBe(true);
});
it('should update selectedActivePeriod after onItemSelect', () => {
- component['onItemSelect'](component.items[1]);
+ if (component.items[1]) {
+ component['onItemSelect'](component.items[1]);
+ }
expect(testComponent.component?.selectedActivePeriod?.toString()).toBe(
'Today',
diff --git a/projects/kit/components/filter/test/filter.component.spec.ts b/projects/kit/components/filter/test/filter.component.spec.ts
index 66749a64c846..e71e6ac35ef0 100644
--- a/projects/kit/components/filter/test/filter.component.spec.ts
+++ b/projects/kit/components/filter/test/filter.component.spec.ts
@@ -94,7 +94,10 @@ describe('Filter', () => {
});
it('set from checked items', () => {
- component.onCheckbox(true, ARR_STRING[0]);
+ if (ARR_STRING[0]) {
+ component.onCheckbox(true, ARR_STRING[0]);
+ }
+
fixture.detectChanges();
expect(testComponent.control.value).toEqual(ARR_STRING);
diff --git a/projects/kit/components/tabs/test/tabs.component.spec.ts b/projects/kit/components/tabs/test/tabs.component.spec.ts
index 84fdf7c9cfaa..133f8affb9c1 100644
--- a/projects/kit/components/tabs/test/tabs.component.spec.ts
+++ b/projects/kit/components/tabs/test/tabs.component.spec.ts
@@ -70,7 +70,7 @@ describe('Tabs', () => {
expect(firstTab).toEqual(component.tabsDirective.activeElement);
- secondTab.click();
+ secondTab?.click();
fixture.detectChanges();
expect(firstTab).not.toEqual(component.tabsDirective.activeElement);
@@ -82,14 +82,14 @@ describe('Tabs', () => {
(tab) => tab.nativeElement as HTMLButtonElement,
);
- expect(firstTab.classList.contains('_active')).toBeTruthy();
- expect(secondTab.classList.contains('_active')).toBeFalsy();
+ expect(firstTab?.classList.contains('_active')).toBeTruthy();
+ expect(secondTab?.classList.contains('_active')).toBeFalsy();
- secondTab.click();
+ secondTab?.click();
fixture.detectChanges();
- expect(firstTab.classList.contains('_active')).toBeFalsy();
- expect(secondTab.classList.contains('_active')).toBeTruthy();
+ expect(firstTab?.classList.contains('_active')).toBeFalsy();
+ expect(secondTab?.classList.contains('_active')).toBeTruthy();
});
});
});
diff --git a/projects/legacy/components/combo-box/test/combo-box.component.spec.ts b/projects/legacy/components/combo-box/test/combo-box.component.spec.ts
index 7cdf684fa04b..7b3fa6b89993 100644
--- a/projects/legacy/components/combo-box/test/combo-box.component.spec.ts
+++ b/projects/legacy/components/combo-box/test/combo-box.component.spec.ts
@@ -136,7 +136,7 @@ describe('ComboBox', () => {
testComponent.defaultInputs = false;
fixture.detectChanges();
- expect(getValue()!.nativeElement.textContent.trim()).toBe(ITEMS[0].trait);
+ expect(getValue()!.nativeElement.textContent.trim()).toBe(ITEMS[0]?.trait);
});
});
diff --git a/projects/legacy/components/input-date-range/test/input-date-range.component.spec.ts b/projects/legacy/components/input-date-range/test/input-date-range.component.spec.ts
index 7711bb9f2eb8..dfe25b7e132e 100644
--- a/projects/legacy/components/input-date-range/test/input-date-range.component.spec.ts
+++ b/projects/legacy/components/input-date-range/test/input-date-range.component.spec.ts
@@ -234,8 +234,14 @@ describe('InputDateRangeComponent', () => {
expect(leftCalendar).toBeTruthy();
expect(rightCalendar).toBeTruthy();
- getCalendarCell(leftCalendar, 16)?.nativeElement?.click();
- getCalendarCell(rightCalendar, 27)?.nativeElement?.click();
+ if (leftCalendar) {
+ getCalendarCell(leftCalendar, 16)?.nativeElement?.click();
+ }
+
+ if (rightCalendar) {
+ getCalendarCell(rightCalendar, 27)?.nativeElement?.click();
+ }
+
fixture.detectChanges();
await fixture.whenStable();
@@ -278,8 +284,13 @@ describe('InputDateRangeComponent', () => {
expect(leftCalendar).toBeTruthy();
expect(rightCalendar).toBeTruthy();
- getCalendarCell(leftCalendar, 12)?.nativeElement?.click();
- getCalendarCell(rightCalendar, 18)?.nativeElement?.click();
+ if (leftCalendar) {
+ getCalendarCell(leftCalendar, 12)?.nativeElement?.click();
+ }
+
+ if (rightCalendar) {
+ getCalendarCell(rightCalendar, 18)?.nativeElement?.click();
+ }
fixture.detectChanges();
@@ -435,8 +446,13 @@ describe('InputDateRangeComponent', () => {
expect(leftCalendar).toBeTruthy();
expect(rightCalendar).toBeTruthy();
- getCalendarCell(leftCalendar, 12)?.nativeElement?.click();
- getCalendarCell(rightCalendar, 18)?.nativeElement?.click();
+ if (leftCalendar) {
+ getCalendarCell(leftCalendar, 12)?.nativeElement?.click();
+ }
+
+ if (rightCalendar) {
+ getCalendarCell(rightCalendar, 18)?.nativeElement?.click();
+ }
fixture.detectChanges();
diff --git a/projects/legacy/components/input-phone/test/complete-phone-insertion-preprocessor.spec.ts b/projects/legacy/components/input-phone/test/complete-phone-insertion-preprocessor.spec.ts
index b4915308c254..0e09bd0fecfe 100644
--- a/projects/legacy/components/input-phone/test/complete-phone-insertion-preprocessor.spec.ts
+++ b/projects/legacy/components/input-phone/test/complete-phone-insertion-preprocessor.spec.ts
@@ -34,7 +34,7 @@ describe('tuiCreateCompletePhoneInsertionPreprocessor + browser autofill', () =>
tests.forEach(([before, after]) => {
it(`${before} => ${after}`, () => {
- expect(maskitoTransform(before, maskOptions)).toBe(after);
+ expect(maskitoTransform(before ?? '', maskOptions)).toBe(after);
});
});
});
@@ -63,7 +63,7 @@ describe('tuiCreateCompletePhoneInsertionPreprocessor + browser autofill', () =>
tests.forEach(([before, after]) => {
it(`${before} => ${after}`, () => {
- expect(maskitoTransform(before, maskOptions)).toBe(after);
+ expect(maskitoTransform(before ?? '', maskOptions)).toBe(after);
});
});
});
diff --git a/projects/legacy/components/input-range/test/input-range.component.spec.ts b/projects/legacy/components/input-range/test/input-range.component.spec.ts
index ee8cf3b49f67..c9356c488b15 100644
--- a/projects/legacy/components/input-range/test/input-range.component.spec.ts
+++ b/projects/legacy/components/input-range/test/input-range.component.spec.ts
@@ -202,7 +202,7 @@ describe('InputRange', () => {
testComponent.control.value?.[1],
);
expect(inputPOLeft.value).toBe(
- `${testComponent.control.value?.[1].toString()} лет`,
+ `${testComponent.control.value?.[1]?.toString()} лет`,
);
});
@@ -217,7 +217,7 @@ describe('InputRange', () => {
);
expect(inputPORight.value).toBe(
`${testComponent.control.value?.[0]
- .toString()
+ ?.toString()
.replace(CHAR_HYPHEN, CHAR_MINUS)} лет`,
);
});
diff --git a/projects/legacy/components/input-time/test/input-time.component.spec.ts b/projects/legacy/components/input-time/test/input-time.component.spec.ts
index 92fa4b26c58b..2e42b7c9731f 100644
--- a/projects/legacy/components/input-time/test/input-time.component.spec.ts
+++ b/projects/legacy/components/input-time/test/input-time.component.spec.ts
@@ -282,7 +282,7 @@ describe('InputTime', () => {
pageObject.getByAutomationId('tui-input-time__item')!.nativeElement.click();
expect(testComponent.control.value?.toString().trim()).toBe(
- TIMES[6].toString(),
+ TIMES[6]?.toString(),
);
});
diff --git a/projects/legacy/components/input/test/input.component.spec.ts b/projects/legacy/components/input/test/input.component.spec.ts
index dfd13cdfae4d..a2915c5e24b1 100644
--- a/projects/legacy/components/input/test/input.component.spec.ts
+++ b/projects/legacy/components/input/test/input.component.spec.ts
@@ -174,7 +174,7 @@ describe('Input', () => {
.getByAutomationId('tui-data-list-wrapper__option')!
.nativeElement.click();
- expect(testComponent.control.value).toBe(ITEMS[0].toString());
+ expect(testComponent.control.value).toBe(ITEMS[0]?.toString());
});
});
@@ -289,7 +289,7 @@ describe('Input', () => {
});
it('focus in the dropdown', () => {
- expect(tuiActiveText()).toBe(ITEMS[0].toString());
+ expect(tuiActiveText()).toBe(ITEMS[0]?.toString());
});
it('entering characters brings focus to the input field', () => {
diff --git a/projects/legacy/components/multi-select/multi-select-group/multi-select-group.component.ts b/projects/legacy/components/multi-select/multi-select-group/multi-select-group.component.ts
index c521a43b359a..3a2a21624558 100644
--- a/projects/legacy/components/multi-select/multi-select-group/multi-select-group.component.ts
+++ b/projects/legacy/components/multi-select/multi-select-group/multi-select-group.component.ts
@@ -62,7 +62,7 @@ export class TuiMultiSelectGroupComponent {
for (let i = 0; i < items.length; i++) {
const selected = current.some((selected) =>
- this.matcher(selected, items[i]),
+ this.matcher(selected, items[i]!),
);
if ((!selected && result) || (selected && !result && i)) {
diff --git a/scripts/shared/parse-version.ts b/scripts/shared/parse-version.ts
index 7cdadca27d3d..46430e514394 100644
--- a/scripts/shared/parse-version.ts
+++ b/scripts/shared/parse-version.ts
@@ -6,7 +6,7 @@ interface ParsedVersion {
}
export function parseVersion(version: string): ParsedVersion {
- const [major, minor, patch, , rc = -1] = version
+ const [major = 0, minor = 0, patch = 0, , rc = -1] = version
.split(/[.-]/)
.map((value) => Number(value));
diff --git a/tsconfig.json b/tsconfig.json
index 79465c5ffbfe..87f4a5e1c6a2 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,7 +4,6 @@
"baseUrl": "./",
"outDir": "./dist",
"typeRoots": ["node_modules/@types"],
- "verbatimModuleSyntax": true,
"paths": {
"@demo-cypress/*": ["projects/demo-cypress/cypress/*"],
"@demo-playwright/utils": ["projects/demo-playwright/utils/index"],