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; }