diff --git a/projects/addon-commerce/components/input-card-grouped/input-card-grouped.component.ts b/projects/addon-commerce/components/input-card-grouped/input-card-grouped.component.ts index 62edafec4452b..69a1f0cca1e06 100644 --- a/projects/addon-commerce/components/input-card-grouped/input-card-grouped.component.ts +++ b/projects/addon-commerce/components/input-card-grouped/input-card-grouped.component.ts @@ -189,7 +189,7 @@ export class TuiInputCardGroupedComponent } get hasCleaner(): boolean { - return !!this.value?.card?.trim() && !this.readOnly && !this.computedDisabled; + return !!this.value?.card.trim() && !this.readOnly && !this.computedDisabled; } get hasDropdown(): boolean { @@ -201,7 +201,7 @@ export class TuiInputCardGroupedComponent } get hasCardNumber(): boolean { - return !!this.value?.card?.trim(); + return !!this.value?.card.trim(); } get idCard(): string { diff --git a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts index b3f73eb9fc05b..914766bfd0452 100644 --- a/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts +++ b/projects/addon-commerce/components/input-card-grouped/test/input-card-grouped.component.spec.ts @@ -270,7 +270,7 @@ describe(`InputCardGrouped`, () => { function expectCardOutlet(): boolean { return ( - fixture.componentRef.location?.nativeElement?.querySelectorAll( + fixture.componentRef.location.nativeElement?.querySelectorAll( `.t-icon-outlet`, )?.length === 1 || false ); diff --git a/projects/addon-doc/components/code/tests/code.component.spec.ts b/projects/addon-doc/components/code/tests/code.component.spec.ts index 873284c08ea18..2eb454cc578f0 100644 --- a/projects/addon-doc/components/code/tests/code.component.spec.ts +++ b/projects/addon-doc/components/code/tests/code.component.spec.ts @@ -96,7 +96,7 @@ describe(`TuiDocCodeComponent`, () => { }); async function waitHighlightJsParseContent(): Promise { - await fixture?.whenStable(); + await fixture.whenStable(); fixture.detectChanges(); await new Promise(resolve => { setTimeout(resolve, 100); diff --git a/projects/addon-mobile/components/app-bar/app-bar.component.ts b/projects/addon-mobile/components/app-bar/app-bar.component.ts index e2f3ce8c38820..a5b612c810b81 100644 --- a/projects/addon-mobile/components/app-bar/app-bar.component.ts +++ b/projects/addon-mobile/components/app-bar/app-bar.component.ts @@ -29,8 +29,8 @@ export class TuiAppBarComponent { () => 2 * Math.max( - this.side.first?.nativeElement.clientWidth, - this.side.last?.nativeElement.clientWidth, + this.side.first.nativeElement.clientWidth, + this.side.last.nativeElement.clientWidth, ), ), ); diff --git a/projects/addon-mobile/components/sheet/directives/sheet-close/sheet-close.directive.ts b/projects/addon-mobile/components/sheet/directives/sheet-close/sheet-close.directive.ts index dfc16a1eddeb8..fefff907f13fe 100644 --- a/projects/addon-mobile/components/sheet/directives/sheet-close/sheet-close.directive.ts +++ b/projects/addon-mobile/components/sheet/directives/sheet-close/sheet-close.directive.ts @@ -21,7 +21,7 @@ export class TuiSheetCloseDirective { () => this.scroll$.pipe(startWith(this.el.nativeElement.scrollTop)), tuiIsFalsy, ), - filter(y => this.sheet.item?.closeable && this.shouldClose(y)), + filter(y => this.sheet.item.closeable && this.shouldClose(y)), distinctUntilChanged(), tuiZonefull(this.zone), ), diff --git a/projects/addon-table/components/table/th/th.component.ts b/projects/addon-table/components/table/th/th.component.ts index 2ed676eae6498..8d13d719c9c74 100644 --- a/projects/addon-table/components/table/th/th.component.ts +++ b/projects/addon-table/components/table/th/th.component.ts @@ -87,6 +87,6 @@ export class TuiThComponent>> { } private get isCurrentAndAscDirection(): boolean { - return this.sorter === this.table?.sorter && this.table?.direction === -1; + return this.sorter === this.table?.sorter && this.table.direction === -1; } } diff --git a/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts b/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts index 9bef87ef052e0..d89149c5a27e8 100644 --- a/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts +++ b/projects/addon-tablebars/components/table-bars-host/test/table-bars-host.component.spec.ts @@ -51,7 +51,7 @@ describe(`TableBarsHost`, () => { component = testComponent.component; service = TestBed.inject(TuiTableBarsService); (service.bar$ as any)._events = []; - subscription?.unsubscribe(); + subscription.unsubscribe(); }); function getBar(): DebugElement { diff --git a/projects/cdk/classes/test/validation-error.spec.ts b/projects/cdk/classes/test/validation-error.spec.ts index 63f51cd31d0e1..ebcbffc3eea86 100644 --- a/projects/cdk/classes/test/validation-error.spec.ts +++ b/projects/cdk/classes/test/validation-error.spec.ts @@ -5,6 +5,6 @@ describe(`TuiValidationError`, () => { const error = new TuiValidationError(`content`, {test: `context`}); expect(error.message).toBe(`content`); - expect(error.context?.test).toBe(`context`); + expect(error.context.test).toBe(`context`); }); }); diff --git a/projects/cdk/components/dialog-host/dialog-host.component.ts b/projects/cdk/components/dialog-host/dialog-host.component.ts index e5c2b6a70a77d..edec757f6167a 100644 --- a/projects/cdk/components/dialog-host/dialog-host.component.ts +++ b/projects/cdk/components/dialog-host/dialog-host.component.ts @@ -26,7 +26,7 @@ const FAKE_HISTORY_STATE = {label: 'ignoreMe'} as const; const isFakeHistoryState = ( historyState: Record, ): historyState is typeof FAKE_HISTORY_STATE => - historyState?.label === FAKE_HISTORY_STATE.label; + historyState.label === FAKE_HISTORY_STATE.label; @Component({ selector: 'tui-dialog-host', diff --git a/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts b/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts index bbbc604a6c7ca..56763e6b8311d 100644 --- a/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts +++ b/projects/cdk/directives/active-zone/tests/active-zone.directive.spec.ts @@ -87,7 +87,7 @@ describe(`TuiActiveZoneDirective`, () => { } onClick(element: HTMLInputElement): void { - element?.focus(); + element.focus(); } } diff --git a/projects/cdk/directives/autofilled/autofilled.directive.ts b/projects/cdk/directives/autofilled/autofilled.directive.ts index b54d013683d16..2829f2bc923b5 100644 --- a/projects/cdk/directives/autofilled/autofilled.directive.ts +++ b/projects/cdk/directives/autofilled/autofilled.directive.ts @@ -30,7 +30,7 @@ export class TuiAutofilledDirective { @HostListener('transitionstart', ['$event']) transitionStartHandler({propertyName, target}: TransitionEvent): void { const matchedAutofill = - propertyName.includes('box-shadow') && (target as Element)?.matches('input'); + propertyName.includes('box-shadow') && (target as Element).matches('input'); if (matchedAutofill) { this.autofilled = !this.autofilled; diff --git a/projects/cdk/directives/autofilled/test/autofilled.directive.spec.ts b/projects/cdk/directives/autofilled/test/autofilled.directive.spec.ts index 1b535f332b000..d73b43f68404c 100644 --- a/projects/cdk/directives/autofilled/test/autofilled.directive.spec.ts +++ b/projects/cdk/directives/autofilled/test/autofilled.directive.spec.ts @@ -85,7 +85,7 @@ function getInput(fixture: ComponentFixture): HTMLInputElement { } function getInputClassList(fixture: ComponentFixture): string[] { - return Array.from(getInput(fixture)?.classList || []).filter( + return Array.from(getInput(fixture).classList || []).filter( className => !className.includes(`ng-`), ); } diff --git a/projects/cdk/directives/overscroll/overscroll.directive.ts b/projects/cdk/directives/overscroll/overscroll.directive.ts index 4328ba78faeea..0361dbf12c194 100644 --- a/projects/cdk/directives/overscroll/overscroll.directive.ts +++ b/projects/cdk/directives/overscroll/overscroll.directive.ts @@ -102,7 +102,7 @@ export class TuiOverscrollDirective { if ( !cancelable || !tuiIsElement(target) || - (target as HTMLInputElement)?.type === 'range' + (target as HTMLInputElement).type === 'range' ) { return; } diff --git a/projects/cdk/observables/is-observed.ts b/projects/cdk/observables/is-observed.ts index b48fb6185132b..3f72a1b5882a2 100644 --- a/projects/cdk/observables/is-observed.ts +++ b/projects/cdk/observables/is-observed.ts @@ -9,5 +9,5 @@ type SubjectRxJS6 = Subject & {observers: Array>}; export function tuiIsObserved(observable: Subject): boolean { return `observed` in observable ? (observable as SubjectRxJS7plus).observed - : !!(observable as SubjectRxJS6)?.observers?.length; + : !!(observable as SubjectRxJS6).observers.length; } diff --git a/projects/cdk/schematics/ng-update/steps/replace-const.ts b/projects/cdk/schematics/ng-update/steps/replace-const.ts index 76ed936ced8ac..a1ad02b7e68a4 100644 --- a/projects/cdk/schematics/ng-update/steps/replace-const.ts +++ b/projects/cdk/schematics/ng-update/steps/replace-const.ts @@ -44,7 +44,7 @@ export function replaceConst({from, to}: ReplacementConst): void { to.moduleSpecifier, ); } else { - ref?.replaceWithText(to.name); + ref.replaceWithText(to.name); } }); } diff --git a/projects/cdk/schematics/ng-update/steps/replace-enums.ts b/projects/cdk/schematics/ng-update/steps/replace-enums.ts index 1007f22f3dda7..976260af90deb 100644 --- a/projects/cdk/schematics/ng-update/steps/replace-enums.ts +++ b/projects/cdk/schematics/ng-update/steps/replace-enums.ts @@ -46,7 +46,7 @@ function replaceEnumWithString( if (Node.isTypeReferenceNode(parent) && !keepAsType) { const declaration = parent.getParent() as VariableDeclaration; - declaration.removeType?.(); + declaration.removeType(); continue; } diff --git a/projects/cdk/schematics/ng-update/steps/replace-services.ts b/projects/cdk/schematics/ng-update/steps/replace-services.ts index ec7459fd7dd4d..44d185b47e540 100644 --- a/projects/cdk/schematics/ng-update/steps/replace-services.ts +++ b/projects/cdk/schematics/ng-update/steps/replace-services.ts @@ -72,7 +72,7 @@ function replaceProperties( const statement = parent.getParent(); const identifier = statement.getChildrenOfKind(SyntaxKind.Identifier)[0]; - identifier?.findReferencesAsNodes().forEach(ref => { + identifier.findReferencesAsNodes().forEach(ref => { let parent = ref.getParent(); if ( diff --git a/projects/cdk/schematics/ng-update/v3-5/steps/migrate-expand-templates.ts b/projects/cdk/schematics/ng-update/v3-5/steps/migrate-expand-templates.ts index b6da8467e7bb9..d5e6fa991546a 100644 --- a/projects/cdk/schematics/ng-update/v3-5/steps/migrate-expand-templates.ts +++ b/projects/cdk/schematics/ng-update/v3-5/steps/migrate-expand-templates.ts @@ -73,7 +73,7 @@ function migrateExpand({ attr => attr.name === `tuiexpandcontent`, ); - const insertTo = templateElement?.sourceCodeLocation?.startTag.endOffset; + const insertTo = templateElement.sourceCodeLocation?.startTag.endOffset; if (!insertTo || tuiExpandAttr) { return; diff --git a/projects/cdk/schematics/ng-update/v3/steps/migrate-date-time.ts b/projects/cdk/schematics/ng-update/v3/steps/migrate-date-time.ts index 7cd3e80b07608..18d404731b985 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/migrate-date-time.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/migrate-date-time.ts @@ -248,7 +248,7 @@ function replaceIdentifierReferences( } if (parent?.getText().startsWith(`this`)) { - parent = parent?.getParent(); + parent = parent.getParent(); } if (Node.isPropertyAccessExpression(parent)) { diff --git a/projects/cdk/schematics/ng-update/v3/steps/migrate-polymorpheus.ts b/projects/cdk/schematics/ng-update/v3/steps/migrate-polymorpheus.ts index 27b6177b72c34..ba1bd4f587ac3 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/migrate-polymorpheus.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/migrate-polymorpheus.ts @@ -85,7 +85,7 @@ function insertPolymorpheus({ {{ text }} `; - const insertTo = element.sourceCodeLocation?.startTag?.endOffset; + const insertTo = element.sourceCodeLocation?.startTag.endOffset; if (insertTo) { recorder.insertRight(insertTo + templateOffset, content); diff --git a/projects/cdk/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.ts b/projects/cdk/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.ts index f53d165ff5be1..7063bd6d6f525 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.ts @@ -70,13 +70,13 @@ export function migrateTaigaProprietaryIcons(options: TuiSchema): Rule { return; } - if (Array.isArray(targetOptions?.assets)) { + if (Array.isArray(targetOptions.assets)) { const tdsSrc = `@taiga-ui/proprietary-tds-icons/src`; const hasIcons = (targetOptions.assets as Asset[]).find( asset => tuiIsString(asset) ? asset.includes(tdsSrc) - : asset?.input?.includes(tdsSrc), + : asset.input.includes(tdsSrc), ); if (hasIcons) { diff --git a/projects/cdk/schematics/ng-update/v3/steps/migrate-templates.ts b/projects/cdk/schematics/ng-update/v3/steps/migrate-templates.ts index f5e1aea39ecaa..756ae1cc8a14d 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/migrate-templates.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/migrate-templates.ts @@ -220,7 +220,7 @@ function replaceBreadcrumbs({ elements.forEach(element => { const itemsAttr = element.attrs.find(attr => attr.name === `[items]`); const itemsValue = itemsAttr?.value; - const insertTo = element?.sourceCodeLocation?.startTag.endOffset; + const insertTo = element.sourceCodeLocation?.startTag.endOffset; if (!itemsValue || !insertTo) { return; @@ -346,9 +346,8 @@ function migrateTuiHideSelectedPipe({ const template = getTemplateFromTemplateResource(resource, fileSystem); const templateOffset = getTemplateOffset(resource); - const elementsWithPipe = findElementsInTemplateByFn( - template, - el => el.attrs?.some(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)), + const elementsWithPipe = findElementsInTemplateByFn(template, el => + el.attrs.some(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)), ); elementsWithPipe.forEach(el => { @@ -387,14 +386,11 @@ function migrateBinaryAttributes({ const templateOffset = getTemplateOffset(resource); TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach(attrName => { - const elements = findElementsInTemplateByFn( - template, - el => - el.attrs?.some( - attr => - attr.value === `true` && - attr.name.includes(attrName.toLowerCase()), - ), + const elements = findElementsInTemplateByFn(template, el => + el.attrs.some( + attr => + attr.value === `true` && attr.name.includes(attrName.toLowerCase()), + ), ); elements.forEach(el => { diff --git a/projects/cdk/schematics/ng-update/v3/steps/migrate-textfield-controller.ts b/projects/cdk/schematics/ng-update/v3/steps/migrate-textfield-controller.ts index 3eb9f4a100145..c32c99b7ee830 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/migrate-textfield-controller.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/migrate-textfield-controller.ts @@ -108,7 +108,7 @@ function insertTuiTextfieldInput({ ? ` ` : ` `; - const insertTo = element.sourceCodeLocation?.endTag?.startOffset; + const insertTo = element.sourceCodeLocation?.endTag.startOffset; if (insertTo) { recorder.insertRight(insertTo + templateOffset, content); @@ -166,5 +166,5 @@ const excludedAttrs: Record = { }; function exclusion({tagName}: Element, attrName: string): boolean { - return excludedAttrs[tagName]?.includes(attrName); + return excludedAttrs[tagName].includes(attrName); } diff --git a/projects/cdk/schematics/ng-update/v3/steps/replace-functions.ts b/projects/cdk/schematics/ng-update/v3/steps/replace-functions.ts index a0eaee5a04003..239a325314839 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/replace-functions.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/replace-functions.ts @@ -42,9 +42,9 @@ function replaceDeprecatedFunction(): void { const parent = ref.getParent(); if (Node.isImportSpecifier(parent) || Node.isCallExpression(parent)) { - parent?.replaceWithText( + parent.replaceWithText( parent - ?.getText({includeJsDocComments: false}) + .getText({includeJsDocComments: false}) .trim() .replace(from, to ?? from), ); @@ -64,7 +64,7 @@ function replacePadStart(references: Node[]): void { parent.replaceWithText( `${targetString.getText()}.padStart(${length.getText()}, ${ - pad?.getText() ?? `" "` + pad.getText() ?? `" "` })`, ); } @@ -83,7 +83,7 @@ function replaceNativeFocused(references: Node[]): void { const setFocused = !focusedArg || focusedArg.getText() === `true`; const focus = `${targetString.getText()}.focus(${ - preventScroll?.getText() ? `{preventScroll: true}` : `` + preventScroll.getText() ? `{preventScroll: true}` : `` })`; const blur = `${targetString.getText()}.blur()`; diff --git a/projects/cdk/schematics/utils/angular-json-manipulations.ts b/projects/cdk/schematics/utils/angular-json-manipulations.ts index 09abaa6f1e5b1..1ca491d0bc3b5 100644 --- a/projects/cdk/schematics/utils/angular-json-manipulations.ts +++ b/projects/cdk/schematics/utils/angular-json-manipulations.ts @@ -26,10 +26,10 @@ export async function isInvalidAngularJson(tree: Tree): Promise { } function hasTaigaIcons(assets: Asset[]): boolean { - return !!assets?.find(asset => + return !!assets.find(asset => tuiIsString(asset) ? asset.includes(`taiga-ui`) - : asset?.input?.includes(`taiga-ui`), + : asset.input.includes(`taiga-ui`), ); } diff --git a/projects/cdk/schematics/utils/get-project-target-options.ts b/projects/cdk/schematics/utils/get-project-target-options.ts index 163fb911eaf9d..0bb67aa9cbc81 100644 --- a/projects/cdk/schematics/utils/get-project-target-options.ts +++ b/projects/cdk/schematics/utils/get-project-target-options.ts @@ -5,7 +5,7 @@ export function getProjectTargetOptions( project: workspaces.ProjectDefinition, buildTarget: string, ): Record { - const buildTargetObject = project.targets?.get(buildTarget); + const buildTargetObject = project.targets.get(buildTarget); if (buildTargetObject?.options) { return buildTargetObject.options; diff --git a/projects/cdk/schematics/utils/push-to-array-property.ts b/projects/cdk/schematics/utils/push-to-array-property.ts index 1628b9c1bf653..994ad0485e5d6 100644 --- a/projects/cdk/schematics/utils/push-to-array-property.ts +++ b/projects/cdk/schematics/utils/push-to-array-property.ts @@ -19,7 +19,7 @@ export function pushToObjectArrayProperty( } if (forceToArray && !Node.isArrayLiteralExpression(property.getInitializer())) { - property.setInitializer(`[${property?.getInitializer()?.getText()}]`); + property.setInitializer(`[${property.getInitializer()?.getText()}]`); } const importsInitializer = property.getInitializer(); diff --git a/projects/cdk/schematics/utils/replace-tag.ts b/projects/cdk/schematics/utils/replace-tag.ts index 7cb5ede46ad02..1d760325cffd4 100644 --- a/projects/cdk/schematics/utils/replace-tag.ts +++ b/projects/cdk/schematics/utils/replace-tag.ts @@ -13,7 +13,7 @@ export function replaceTag( addAttributes: string[] = [], ): void { const startTagOffset = sourceCodeLocation?.startTag.startOffset; - const endTagOffset = sourceCodeLocation?.endTag?.startOffset; + const endTagOffset = sourceCodeLocation?.endTag.startOffset; if (endTagOffset) { recorder.remove(endTagOffset + templateOffset + END_TAG_OFFSET, from.length); diff --git a/projects/cdk/schematics/utils/templates/elements.ts b/projects/cdk/schematics/utils/templates/elements.ts index 33d44dd1681eb..f8662541f6631 100644 --- a/projects/cdk/schematics/utils/templates/elements.ts +++ b/projects/cdk/schematics/utils/templates/elements.ts @@ -55,9 +55,8 @@ export function findElementsWithAttribute( html: string, attributeName: string, ): Element[] { - return findElementsInTemplateByFn( - html, - el => el.attrs?.some(attr => attr.name === attributeName.toLowerCase()), + return findElementsInTemplateByFn(html, el => + el.attrs.some(attr => attr.name === attributeName.toLowerCase()), ); } @@ -74,7 +73,7 @@ export function findElementsWithAttributeOnTag( return findElementsInTemplateByFn( html, el => - el.attrs?.some(attr => + el.attrs.some(attr => attributeNames.map(name => name.toLowerCase()).includes(attr.name), ) && (tagNames.includes(el.tagName) || !tagNames.length), @@ -123,7 +122,7 @@ export function findAttributeOnElementWithAttrs( /** Shorthand function that checks if the specified element contains the given attribute. */ export function hasElementAttribute(element: Element, attributeName: string): boolean { - return element.attrs?.some(attr => attr.name === attributeName.toLowerCase()); + return element.attrs.some(attr => attr.name === attributeName.toLowerCase()); } /** Gets the start offset of the given attribute from a Parse5 element. */ diff --git a/projects/cdk/schematics/utils/templates/get-component-templates.ts b/projects/cdk/schematics/utils/templates/get-component-templates.ts index 12f73ff37ec96..cc2bbab40f297 100644 --- a/projects/cdk/schematics/utils/templates/get-component-templates.ts +++ b/projects/cdk/schematics/utils/templates/get-component-templates.ts @@ -32,7 +32,7 @@ function decoratorToTemplateResource(decorator: Decorator): TemplateResource | n if (templateUrl) { const templatePath = path.parse( - templateUrl?.getInitializer()?.getText().replace(/['"`]/g, ``) || ``, + templateUrl.getInitializer()?.getText().replace(/['"`]/g, ``) || ``, ); return { diff --git a/projects/cdk/services/scroll.service.ts b/projects/cdk/services/scroll.service.ts index f1a89a0e7267e..805d8fbe47ec9 100644 --- a/projects/cdk/services/scroll.service.ts +++ b/projects/cdk/services/scroll.service.ts @@ -46,7 +46,7 @@ export class TuiScrollService { return observable.pipe( tap(([scrollTop, scrollLeft]) => { - elementOrWindow.scrollTo?.(scrollLeft, scrollTop); + elementOrWindow.scrollTo(scrollLeft, scrollTop); }), ); } diff --git a/projects/cdk/tokens/is-firefox.ts b/projects/cdk/tokens/is-firefox.ts index 0fb8586d86eab..1fb448c9475ad 100644 --- a/projects/cdk/tokens/is-firefox.ts +++ b/projects/cdk/tokens/is-firefox.ts @@ -8,5 +8,5 @@ import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils'; export const TUI_IS_FIREFOX = tuiCreateTokenFromFactory( () => typeof (inject(WINDOW) as Window & {mozCancelFullScreen: unknown}) - ?.mozCancelFullScreen !== `undefined`, + .mozCancelFullScreen !== `undefined`, ); diff --git a/projects/cdk/tokens/is-webkit.ts b/projects/cdk/tokens/is-webkit.ts index 096d9f058c8b9..488cd82bad25c 100644 --- a/projects/cdk/tokens/is-webkit.ts +++ b/projects/cdk/tokens/is-webkit.ts @@ -8,5 +8,5 @@ import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils'; export const TUI_IS_WEBKIT = tuiCreateTokenFromFactory( () => !!(inject(WINDOW) as unknown as {webkitConvertPointFromNodeToPage?: unknown}) - ?.webkitConvertPointFromNodeToPage, + .webkitConvertPointFromNodeToPage, ); diff --git a/projects/cdk/tokens/window-size.ts b/projects/cdk/tokens/window-size.ts index f838112f6ae25..e78c83c3c16d9 100644 --- a/projects/cdk/tokens/window-size.ts +++ b/projects/cdk/tokens/window-size.ts @@ -13,8 +13,8 @@ export const TUI_WINDOW_SIZE = new InjectionToken>( return tuiTypedFromEvent(w, `resize`).pipe( startWith(null), map(() => { - const width = Math.max(w.innerWidth, w.visualViewport?.width || 0); - const height = Math.max(w.innerHeight, w.visualViewport?.height || 0); + const width = Math.max(w.innerWidth, w.visualViewport.width || 0); + const height = Math.max(w.innerHeight, w.visualViewport.height || 0); return { width, diff --git a/projects/cdk/utils/browser/is-safari.ts b/projects/cdk/utils/browser/is-safari.ts index 97662ae818ecc..463cc626c66d3 100644 --- a/projects/cdk/utils/browser/is-safari.ts +++ b/projects/cdk/utils/browser/is-safari.ts @@ -1,14 +1,14 @@ export function tuiIsSafari({ownerDocument: doc}: Element): boolean { - const win = doc?.defaultView as unknown as Window & {safari?: any}; + const win = doc.defaultView as unknown as Window & {safari?: any}; const isMacOsSafari = typeof win.safari !== `undefined` && win.safari?.pushNotification?.toString() === `[object SafariRemoteNotification]`; const isIosSafari = - !!win.navigator?.vendor?.includes(`Apple`) && - !win.navigator?.userAgent?.includes(`CriOS`) && - !win.navigator?.userAgent?.includes(`FxiOS`); + !!win.navigator.vendor.includes(`Apple`) && + !win.navigator.userAgent.includes(`CriOS`) && + !win.navigator.userAgent.includes(`FxiOS`); return isMacOsSafari || isIosSafari; } diff --git a/projects/cdk/utils/color/rgba-to-hex.ts b/projects/cdk/utils/color/rgba-to-hex.ts index 79a59b53cae64..465fb1b4cd930 100644 --- a/projects/cdk/utils/color/rgba-to-hex.ts +++ b/projects/cdk/utils/color/rgba-to-hex.ts @@ -9,7 +9,7 @@ export function tuiRgbaToHex(color: string): string { // eslint-disable-next-line unicorn/no-unsafe-regex .match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i) as unknown as number[]) ?? []; - let alpha: number | string = (rgb?.[4] ?? ``).toString().trim(); + let alpha: number | string = (rgb[4] ?? ``).toString().trim(); let hex = rgb ? (rgb[1] | (1 << 8)).toString(16).slice(1) + (rgb[2] | (1 << 8)).toString(16).slice(1) + diff --git a/projects/cdk/utils/dom/get-element-obscurers.ts b/projects/cdk/utils/dom/get-element-obscurers.ts index 68247e798c9be..eebb3a54a5e81 100644 --- a/projects/cdk/utils/dom/get-element-obscurers.ts +++ b/projects/cdk/utils/dom/get-element-obscurers.ts @@ -15,7 +15,7 @@ import {tuiGetDocumentOrShadowRoot} from './get-document-or-shadow-root'; export function tuiGetElementObscures(element: Element): readonly Element[] | null { const {ownerDocument} = element; - if (!ownerDocument?.defaultView || !element.getBoundingClientRect) { + if (!ownerDocument.defaultView || !element.getBoundingClientRect) { return null; } diff --git a/projects/core/components/scrollbar/scrollbar.component.ts b/projects/core/components/scrollbar/scrollbar.component.ts index 1dd8bedc74c69..1ce46e35570b4 100644 --- a/projects/core/components/scrollbar/scrollbar.component.ts +++ b/projects/core/components/scrollbar/scrollbar.component.ts @@ -83,6 +83,6 @@ export class TuiScrollbarComponent { const scrollLeft = offsetLeft + offsetWidth / 2 - clientWidth / 2; // ?. for our clients on Windows XP and Chrome 49 - nativeElement.scrollTo?.(scrollLeft, scrollTop); + nativeElement.scrollTo(scrollLeft, scrollTop); } } diff --git a/projects/core/components/svg/test/svg-options.component.spec.ts b/projects/core/components/svg/test/svg-options.component.spec.ts index 8a02c46c278f8..da80f3e203113 100644 --- a/projects/core/components/svg/test/svg-options.component.spec.ts +++ b/projects/core/components/svg/test/svg-options.component.spec.ts @@ -38,7 +38,7 @@ describe(`SVG options`, () => { beforeEach(() => { fixture = TestBed.createComponent(TestComponent); testComponent = fixture.componentInstance; - fixture?.autoDetectChanges(); + fixture.autoDetectChanges(); }); describe(`Default behaviour`, () => { diff --git a/projects/core/directives/dropdown/dropdown-position-sided.directive.ts b/projects/core/directives/dropdown/dropdown-position-sided.directive.ts index 597d9a628e47b..e2c0fedb0ad8b 100644 --- a/projects/core/directives/dropdown/dropdown-position-sided.directive.ts +++ b/projects/core/directives/dropdown/dropdown-position-sided.directive.ts @@ -44,7 +44,7 @@ export class TuiDropdownPositionSidedDirective extends TuiPositionAccessor { } const {height, width} = rect; - const hostRect = this.vertical.accessor?.getClientRect() ?? EMPTY_CLIENT_RECT; + const hostRect = this.vertical.accessor.getClientRect() ?? EMPTY_CLIENT_RECT; const viewport = this.viewport.getClientRect(); const {direction, minHeight, offset} = this.options; const align = this.options.align === 'center' ? 'left' : this.options.align; diff --git a/projects/core/directives/dropdown/dropdown-position.directive.ts b/projects/core/directives/dropdown/dropdown-position.directive.ts index fb3e26dad3987..068e688152135 100644 --- a/projects/core/directives/dropdown/dropdown-position.directive.ts +++ b/projects/core/directives/dropdown/dropdown-position.directive.ts @@ -35,7 +35,7 @@ export class TuiDropdownPositionDirective extends TuiPositionAccessor { this.previous = undefined; } - const hostRect = this.accessor?.getClientRect() ?? EMPTY_CLIENT_RECT; + const hostRect = this.accessor.getClientRect() ?? EMPTY_CLIENT_RECT; const viewport = this.viewport.getClientRect(); const {minHeight, align, direction, offset} = this.options; const previous = this.previous || direction || 'bottom'; diff --git a/projects/core/services/visual-viewport.service.ts b/projects/core/services/visual-viewport.service.ts index 6532cd44d337b..7ea02f4b106d6 100644 --- a/projects/core/services/visual-viewport.service.ts +++ b/projects/core/services/visual-viewport.service.ts @@ -16,8 +16,8 @@ export class TuiVisualViewportService { correct(point: TuiPoint): TuiPoint { return this.isWebkit ? [ - point[0] + (this.win.visualViewport?.offsetTop ?? 0), - point[1] + (this.win.visualViewport?.offsetLeft ?? 0), + point[0] + (this.win.visualViewport.offsetTop ?? 0), + point[1] + (this.win.visualViewport.offsetLeft ?? 0), ] : point; } diff --git a/projects/core/tokens/reduced-motion.ts b/projects/core/tokens/reduced-motion.ts index 972ec99266935..bd44f87460c0a 100644 --- a/projects/core/tokens/reduced-motion.ts +++ b/projects/core/tokens/reduced-motion.ts @@ -4,6 +4,6 @@ import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk'; export const TUI_REDUCED_MOTION = tuiCreateTokenFromFactory( () => - inject(DOCUMENT).defaultView?.matchMedia?.(`(prefers-reduced-motion: reduce)`) + inject(DOCUMENT).defaultView?.matchMedia(`(prefers-reduced-motion: reduce)`) .matches ?? false, ); diff --git a/projects/core/utils/dom/process-icon.ts b/projects/core/utils/dom/process-icon.ts index 036a6879bde97..6efaca52d1850 100644 --- a/projects/core/utils/dom/process-icon.ts +++ b/projects/core/utils/dom/process-icon.ts @@ -10,7 +10,7 @@ export function tuiProcessIcon(source: string, name: string): string { const src = source.slice(Math.max(0, source.indexOf(START))); const attributes = src.slice(0, Math.max(0, src.indexOf(`>`))); - if (!attributes?.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) { + if (!attributes.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) { return `${src.replace( START, ` { cy.tuiVisit(`/${path}/API`); cy.get(`table.t-table tui-select`).each(($select, selectIndex) => { - if (selectExclusions[path]?.includes(selectIndex)) { + if (selectExclusions[path].includes(selectIndex)) { return cy.wrap($select, {log: false}); } @@ -55,7 +55,7 @@ describe(`Deep`, () => { : [], ) .each((toggle$, index) => { - if (toggleExclusions[path]?.includes(index)) { + if (toggleExclusions[path].includes(index)) { return cy.wrap(toggle$, {log: false}); } diff --git a/projects/demo-playwright/tests/demo/is-flaky-examples.ts b/projects/demo-playwright/tests/demo/is-flaky-examples.ts index b9d0fc253ef47..24d9b2a2b3876 100644 --- a/projects/demo-playwright/tests/demo/is-flaky-examples.ts +++ b/projects/demo-playwright/tests/demo/is-flaky-examples.ts @@ -18,7 +18,7 @@ const FLAKY_EXAMPLES = new Map([ export function tuiIsFlakyExample(path: string, exampleIndex: number): boolean { const exclusions = FLAKY_EXAMPLES.get(path) ?? []; - const excluded = !!exclusions?.includes(exampleIndex); + const excluded = !!exclusions.includes(exampleIndex); if (excluded) { console.info(`skip test for: ${path}[${exampleIndex}]`); diff --git a/projects/demo/src/modules/app/app.component.ts b/projects/demo/src/modules/app/app.component.ts index 3e37dd3e681d3..98906f1fb08fd 100644 --- a/projects/demo/src/modules/app/app.component.ts +++ b/projects/demo/src/modules/app/app.component.ts @@ -96,13 +96,13 @@ export class AppComponent extends AbstractDemoComponent implements OnInit { * we use fallback for correct processing of routing */ private setBaseHrefIfNotPresent(): void { - if (this.doc.getElementsByTagName('base')?.[0]?.href) { + if (this.doc.getElementsByTagName('base')[0].href) { return; } const base = this.doc.createElement('base'); base.href = this.appBaseHref; - this.doc.getElementsByTagName('head')?.[0]?.appendChild(base); + this.doc.getElementsByTagName('head')[0].appendChild(base); } } diff --git a/projects/demo/src/modules/app/stackblitz/stackblitz-deps.service.ts b/projects/demo/src/modules/app/stackblitz/stackblitz-deps.service.ts index 4919785315095..5624e8e228bb5 100644 --- a/projects/demo/src/modules/app/stackblitz/stackblitz-deps.service.ts +++ b/projects/demo/src/modules/app/stackblitz/stackblitz-deps.service.ts @@ -17,7 +17,7 @@ export class StackblitzDepsService { private async getAngularPackages(): Promise> { const {dependencies} = await import(`@demo/root-package`); - const ngVersion = `${dependencies[`@angular/cdk`]?.split(`.`)?.[0] ?? ``}.x.x`; + const ngVersion = `${dependencies[`@angular/cdk`].split(`.`)[0] ?? ``}.x.x`; return { '@angular/cdk': ngVersion, diff --git a/projects/demo/src/modules/components/combo-box/examples/1/index.ts b/projects/demo/src/modules/components/combo-box/examples/1/index.ts index 71325dfae8bf9..7534768365db6 100644 --- a/projects/demo/src/modules/components/combo-box/examples/1/index.ts +++ b/projects/demo/src/modules/components/combo-box/examples/1/index.ts @@ -49,7 +49,7 @@ export class TuiComboBoxExample1 { } extractValueFromEvent(event: Event): string | null { - return (event.target as HTMLInputElement)?.value || null; + return (event.target as HTMLInputElement).value || null; } /** diff --git a/projects/demo/src/modules/components/dialog/examples/9/pay-modal/pay-modal.component.ts b/projects/demo/src/modules/components/dialog/examples/9/pay-modal/pay-modal.component.ts index 5a8ea513b266a..e28383714867b 100644 --- a/projects/demo/src/modules/components/dialog/examples/9/pay-modal/pay-modal.component.ts +++ b/projects/demo/src/modules/components/dialog/examples/9/pay-modal/pay-modal.component.ts @@ -50,7 +50,7 @@ export class PayModalComponent implements OnInit { paymentMode: TuiValuesOf = PaymentMode.ByNewCard; loading$ = new BehaviorSubject(false); payProcessing$ = new BehaviorSubject(false); - amount: number = this.context?.data?.amount ?? 0; + amount: number = this.context.data.amount ?? 0; readonly PAYMENT_MODE = PaymentMode; constructor( diff --git a/projects/demo/src/modules/components/input-files/examples/3/index.ts b/projects/demo/src/modules/components/input-files/examples/3/index.ts index fb2a47063f7da..5f0b0fa648303 100644 --- a/projects/demo/src/modules/components/input-files/examples/3/index.ts +++ b/projects/demo/src/modules/components/input-files/examples/3/index.ts @@ -55,14 +55,14 @@ export class TuiInputFilesExample3 { this.restoredFiles = [...this.restoredFiles, file]; this.removedFiles = this.removedFiles.filter( - removed => file.name !== removed?.name, + removed => file.name !== removed.name, ); } remove(file: TuiFileLike): void { this.removedFiles = [...this.removedFiles, file]; this.restoredFiles = this.restoredFiles.filter( - restored => file.name !== restored?.name, + restored => file.name !== restored.name, ); } } diff --git a/projects/demo/src/modules/components/input-slider/examples/2/index.ts b/projects/demo/src/modules/components/input-slider/examples/2/index.ts index 7e783268c1989..a74b7fb3ae8b3 100644 --- a/projects/demo/src/modules/components/input-slider/examples/2/index.ts +++ b/projects/demo/src/modules/components/input-slider/examples/2/index.ts @@ -18,13 +18,13 @@ export class TuiInputSliderExample2 { increase(): void { this.control.patchValue( - Math.min(((this.control?.value as number) ?? 0) + 20, this.max), + Math.min(((this.control.value as number) ?? 0) + 20, this.max), ); } decrease(): void { this.control.patchValue( - Math.max(((this.control?.value as number) ?? 0) - 20, this.min), + Math.max(((this.control.value as number) ?? 0) - 20, this.min), ); } } diff --git a/projects/demo/webpack.config.ts b/projects/demo/webpack.config.ts index 9237dcfc17961..8a0503d1371a1 100644 --- a/projects/demo/webpack.config.ts +++ b/projects/demo/webpack.config.ts @@ -107,7 +107,7 @@ export default (ngConfigs: Configuration): Configuration => { if ( tuiIsObject(rule) && DO_NOT_MUTATE_RAW_FILE_CONTENTS.some( - pattern => rule.test instanceof RegExp && rule.test?.test(pattern), + pattern => rule.test instanceof RegExp && rule.test.test(pattern), ) ) { return {...rule, resourceQuery: {not: [RAW_TS_QUERY]}}; diff --git a/projects/icons/scripts/process-icons.ts b/projects/icons/scripts/process-icons.ts index ee79105b12d52..df759fd3886f4 100644 --- a/projects/icons/scripts/process-icons.ts +++ b/projects/icons/scripts/process-icons.ts @@ -46,7 +46,7 @@ function wrapIcon(source: string, name: string): WrappedContent | string { const src = source.slice(Math.max(0, source.indexOf(START))); const attributes = src.slice(0, Math.max(0, src.indexOf(`>`))); - if (!attributes?.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) { + if (!attributes.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) { return src; } diff --git a/projects/icons/scripts/rollup-svgo.ts b/projects/icons/scripts/rollup-svgo.ts index ba957206af32b..1696f8a1e1c8b 100644 --- a/projects/icons/scripts/rollup-svgo.ts +++ b/projects/icons/scripts/rollup-svgo.ts @@ -36,10 +36,10 @@ export function tuiRollupSvgo({ try { const result: SvgoResult = optimize(svgString, {path, ...options}); - data = (result as OptimizedSvg)?.data || {}; + data = (result as OptimizedSvg).data || {}; errorMessage = result.error; } catch (err: unknown) { - errorMessage = (err as Error)?.message; + errorMessage = (err as Error).message; } if (errorMessage) { diff --git a/projects/kit/components/avatar/avatar.component.ts b/projects/kit/components/avatar/avatar.component.ts index d736ee46ceeaa..99c33f88b2e8c 100644 --- a/projects/kit/components/avatar/avatar.component.ts +++ b/projects/kit/components/avatar/avatar.component.ts @@ -59,7 +59,7 @@ export class TuiAvatarComponent { } get iconAvatar(): boolean { - return tuiIsString(this.avatarUrl) && !!this.avatarUrl?.startsWith('tuiIcon'); + return tuiIsString(this.avatarUrl) && !!this.avatarUrl.startsWith('tuiIcon'); } get useFallback(): boolean { diff --git a/projects/kit/components/calendar-month/calendar-month.component.ts b/projects/kit/components/calendar-month/calendar-month.component.ts index abf760d4a7574..d1fcbced39ea9 100644 --- a/projects/kit/components/calendar-month/calendar-month.component.ts +++ b/projects/kit/components/calendar-month/calendar-month.component.ts @@ -128,7 +128,7 @@ export class TuiCalendarMonthComponent implements TuiWithOptionalMinMax, TuiFocusableElementAccessor { @ViewChildren(TuiInputNumberComponent) - private readonly inputNumberRefs: QueryList = EMPTY_QUERY; + private readonly inputNumberRefs: QueryList = EMPTY_QUERY; @ViewChild(TuiRangeComponent) private readonly rangeRef: TuiRangeComponent | null = null; diff --git a/projects/kit/components/input-tag/test/input-tag.component.spec.ts b/projects/kit/components/input-tag/test/input-tag.component.spec.ts index a54cbc153860a..98abd8e64897e 100644 --- a/projects/kit/components/input-tag/test/input-tag.component.spec.ts +++ b/projects/kit/components/input-tag/test/input-tag.component.spec.ts @@ -454,7 +454,7 @@ function getPlaceholderText(fixture: ComponentFixture): string { new TuiPageObject(fixture) .getByAutomationId(`tui-input-tag__placeholder`) ?.nativeElement.textContent?.trim() || - new TuiPageObject(fixture)?.getByAutomationId(`tui-input-tag__native`) + new TuiPageObject(fixture).getByAutomationId(`tui-input-tag__native`) ?.nativeElement.placeholder ); } diff --git a/projects/kit/components/items-with-more/items-with-more.service.ts b/projects/kit/components/items-with-more/items-with-more.service.ts index 676cf96d091e4..e8451aff7a123 100644 --- a/projects/kit/components/items-with-more/items-with-more.service.ts +++ b/projects/kit/components/items-with-more/items-with-more.service.ts @@ -32,7 +32,7 @@ export class TuiItemsWithMoreService extends Observable { const items = Array.from(children, ({clientWidth}) => clientWidth); const first = this.directive.required === -1 ? 0 : this.directive.required; const last = items.length - 1; - const more = children[last]?.tagName === `SPAN` ? items[last] : 0; + const more = children[last].tagName === `SPAN` ? items[last] : 0; items.unshift(...items.splice(first, 1)); diff --git a/projects/kit/components/multi-select/multi-select-group/multi-select-group.component.ts b/projects/kit/components/multi-select/multi-select-group/multi-select-group.component.ts index fd0dd7aecd81a..afeab3b57045a 100644 --- a/projects/kit/components/multi-select/multi-select-group/multi-select-group.component.ts +++ b/projects/kit/components/multi-select/multi-select-group/multi-select-group.component.ts @@ -52,7 +52,7 @@ export class TuiMultiSelectGroupComponent { ) {} get size(): TuiSizeL | TuiSizeXS { - return this.options.first?.size || 'm'; + return this.options.first.size || 'm'; } @tuiPure diff --git a/projects/kit/components/routable-dialog/test/generate-dialogable-route.spec.ts b/projects/kit/components/routable-dialog/test/generate-dialogable-route.spec.ts index 3fc4c3a045260..561d2e1dcec79 100644 --- a/projects/kit/components/routable-dialog/test/generate-dialogable-route.spec.ts +++ b/projects/kit/components/routable-dialog/test/generate-dialogable-route.spec.ts @@ -35,32 +35,32 @@ describe(`tuiGenerateDialogableRoute`, () => { ...dialogOptions, }); - expect(result?.data?.dialogOptions).toEqual(dialogOptions); + expect(result.data?.dialogOptions).toEqual(dialogOptions); }); it(`if path is undefined then isLazy: true`, () => { const result = tuiGenerateDialogableRoute(DialogComponent); - expect(result?.data?.isLazy).toBe(true); + expect(result.data?.isLazy).toBe(true); }); it(`if path is empty string then isLazy: true`, () => { const result = tuiGenerateDialogableRoute(DialogComponent, {path: ``}); - expect(result?.data?.isLazy).toBe(true); + expect(result.data?.isLazy).toBe(true); }); it(`if path is not empty string then isLazy: false`, () => { const result = tuiGenerateDialogableRoute(DialogComponent, {path: `path`}); - expect(result?.data?.isLazy).toBe(false); + expect(result.data?.isLazy).toBe(false); }); describe(`checking back url calculation`, () => { it(`back url calculated correctly for undefined path`, () => { const result = tuiGenerateDialogableRoute(DialogComponent); - expect(result?.data?.backUrl).toBe(`..`); + expect(result.data?.backUrl).toBe(`..`); }); it(`back url calculated correctly for empty path`, () => { @@ -68,7 +68,7 @@ describe(`tuiGenerateDialogableRoute`, () => { path: ``, }); - expect(result?.data?.backUrl).toBe(`..`); + expect(result.data?.backUrl).toBe(`..`); }); it(`back url calculated correctly for single segment`, () => { @@ -76,7 +76,7 @@ describe(`tuiGenerateDialogableRoute`, () => { path: `path`, }); - expect(result?.data?.backUrl).toBe(`..`); + expect(result.data?.backUrl).toBe(`..`); }); it(`back url calculated correctly for double segments`, () => { @@ -84,7 +84,7 @@ describe(`tuiGenerateDialogableRoute`, () => { path: `path/to`, }); - expect(result?.data?.backUrl).toBe(`../..`); + expect(result.data?.backUrl).toBe(`../..`); }); it(`back url calculated correctly for triple segments`, () => { @@ -92,7 +92,7 @@ describe(`tuiGenerateDialogableRoute`, () => { path: `path/to/dialog`, }); - expect(result?.data?.backUrl).toBe(`../../..`); + expect(result.data?.backUrl).toBe(`../../..`); }); }); }); diff --git a/projects/kit/components/tree/directives/tree-node.directive.ts b/projects/kit/components/tree/directives/tree-node.directive.ts index f3c15c2a63400..26a5d2862f891 100644 --- a/projects/kit/components/tree/directives/tree-node.directive.ts +++ b/projects/kit/components/tree/directives/tree-node.directive.ts @@ -10,7 +10,7 @@ import {TUI_TREE_ACCESSOR} from '../misc/tree.tokens'; export class TuiTreeNodeDirective implements OnDestroy { @Input('tuiTreeNode') set value(value: T) { - this.directive?.register(this.component, value); + this.directive.register(this.component, value); } constructor( @@ -22,6 +22,6 @@ export class TuiTreeNodeDirective implements OnDestroy { ) {} ngOnDestroy(): void { - this.directive?.unregister(this.component); + this.directive.unregister(this.component); } } diff --git a/projects/kit/pipes/field-error/field-error-pipe.ts b/projects/kit/pipes/field-error/field-error-pipe.ts index 5ce6519790e69..4abec7db4762d 100644 --- a/projects/kit/pipes/field-error/field-error-pipe.ts +++ b/projects/kit/pipes/field-error/field-error-pipe.ts @@ -99,7 +99,7 @@ export class TuiFieldErrorPipe implements PipeTransform, ControlValueAccessor { order: readonly string[], controlErrors: Record, ): string { - const id = order?.find(errorId => controlErrors[errorId]); + const id = order.find(errorId => controlErrors[errorId]); const fallback = Object.keys(controlErrors)[0]; return id || fallback || ``; diff --git a/projects/testing/cypress/commands/wait-all-img-inside.command.ts b/projects/testing/cypress/commands/wait-all-img-inside.command.ts index 75d4d1490458a..ce81e6870ad3b 100644 --- a/projects/testing/cypress/commands/wait-all-img-inside.command.ts +++ b/projects/testing/cypress/commands/wait-all-img-inside.command.ts @@ -28,7 +28,7 @@ export const tuiWaitAllImgInside = ( .get(`img`, {log: false}) .each((img: JQuery) => { const nativeImage = img.get(0); - const url = nativeImage?.src || nativeImage?.srcset; + const url = nativeImage.src || nativeImage.srcset; if (!url) { return; diff --git a/scripts/shared/bump-tui-deps.ts b/scripts/shared/bump-tui-deps.ts index a6f4a7bc4db36..7ffd3fcfbe536 100644 --- a/scripts/shared/bump-tui-deps.ts +++ b/scripts/shared/bump-tui-deps.ts @@ -21,9 +21,9 @@ export function bumpTuiDeps({ for (const key of keys) { if (tuiIsString(deps[key])) { deps[key] = isPeerDependency - ? (deps[key] as string)?.replace(prevVersion, newVersion) + ? (deps[key] as string).replace(prevVersion, newVersion) : `^${newVersion}`; - } else if (deps[key]?.hasOwnProperty(`requires`)) { + } else if (deps[key].hasOwnProperty(`requires`)) { bumpTuiDeps({ deps: (deps[key] as Record>).requires, isPeerDependency, diff --git a/scripts/shared/execute.ts b/scripts/shared/execute.ts index 9575fa32896d2..ee07c6074cf43 100644 --- a/scripts/shared/execute.ts +++ b/scripts/shared/execute.ts @@ -12,6 +12,6 @@ export function execute(shell: string, options?: Partial): st encoding: `utf8`, }, ) - ?.toString() + .toString() .trim(); } diff --git a/scripts/shared/is-tui-package-name.ts b/scripts/shared/is-tui-package-name.ts index 4e0fee91871e4..3f7e7c9fa55fe 100644 --- a/scripts/shared/is-tui-package-name.ts +++ b/scripts/shared/is-tui-package-name.ts @@ -1,5 +1,5 @@ export function isTuiPackageName(name: string = ``, ignores: string[]): boolean { return ( - (name?.startsWith(`@taiga-ui/`) || name === `taiga-ui`) && !ignores.includes(name) + (name.startsWith(`@taiga-ui/`) || name === `taiga-ui`) && !ignores.includes(name) ); }