From cd2b708982685cd05a50ee8fd86cb2b4c803feef Mon Sep 17 00:00:00 2001 From: Daniel Riera Date: Wed, 11 Mar 2026 10:21:32 -0400 Subject: [PATCH] =?UTF-8?q?[PM-29526]Remove=20ts=20strict=20ignore=20in?= =?UTF-8?q?=C2=A0settings=20autofill=20component=20=20(#19012)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove ts strict * explicit null check on handleAdvanceMatch * handle null appropriately in uriMatchOptions * add explicit null checks * clean up code * Update autofill.component.ts --- .../popup/settings/autofill.component.ts | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/apps/browser/src/autofill/popup/settings/autofill.component.ts b/apps/browser/src/autofill/popup/settings/autofill.component.ts index acb2aa7a970..e505cb7dd88 100644 --- a/apps/browser/src/autofill/popup/settings/autofill.component.ts +++ b/apps/browser/src/autofill/popup/settings/autofill.component.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { CommonModule } from "@angular/common"; import { Component, DestroyRef, OnInit } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; @@ -159,7 +157,7 @@ export class AutofillComponent implements OnInit { clearClipboard!: ClearClipboardDelaySetting; clearClipboardOptions: { name: string; value: ClearClipboardDelaySetting }[]; defaultUriMatch: UriMatchStrategySetting = UriMatchStrategy.Domain; - uriMatchOptions: { name: string; value: UriMatchStrategySetting; disabled?: boolean }[]; + uriMatchOptions: { name: string; value: UriMatchStrategySetting | null; disabled?: boolean }[]; showCardsCurrentTab: boolean = true; showIdentitiesCurrentTab: boolean = true; /** Non-null asserted. */ @@ -556,17 +554,26 @@ export class AutofillComponent implements OnInit { const isAdvanced = current === UriMatchStrategy.StartsWith || current === UriMatchStrategy.RegularExpression; if (!valueChange || !isAdvanced) { - return await this.domainSettingsService.setDefaultUriMatchStrategy(current); + if (current !== null) { + await this.domainSettingsService.setDefaultUriMatchStrategy(current); + } + return; + } + const contentKey = this.advancedOptionWarningMap[current]; + if (!contentKey) { + return; } AdvancedUriOptionDialogComponent.open(this.dialogService, { - contentKey: this.advancedOptionWarningMap[current], + contentKey, onContinue: async () => { this.additionalOptionsForm.controls.defaultUriMatch.setValue(current); await this.domainSettingsService.setDefaultUriMatchStrategy(current); }, onCancel: async () => { this.additionalOptionsForm.controls.defaultUriMatch.setValue(previous); - await this.domainSettingsService.setDefaultUriMatchStrategy(previous); + if (previous !== null) { + await this.domainSettingsService.setDefaultUriMatchStrategy(previous); + } }, }); } @@ -599,7 +606,10 @@ export class AutofillComponent implements OnInit { strategy === UriMatchStrategy.StartsWith || strategy === UriMatchStrategy.RegularExpression ) { - hints.push(this.advancedOptionWarningMap[strategy]); + const hint = this.advancedOptionWarningMap[strategy]; + if (hint) { + hints.push(hint); + } } return hints; }