1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-05 19:23:19 +00:00

fix type errors

This commit is contained in:
✨ Audrey ✨
2025-08-11 15:08:14 -04:00
parent 21caa96b2d
commit 69f5455255
2 changed files with 15 additions and 1 deletions

View File

@@ -67,7 +67,8 @@ export class PasswordAuthenticationComponent {
withLatestFrom(sendId$, this.formGroup.valueChanges),
map(([, sendId, { password }]) => [sendId, password ?? ""] as const),
concatMap((params) => this.access.authenticate$(...params)),
map((success) => (success ? "success" : "failed")),
// FIXME: remove type assertion once we're on a typescript version that properly infers the type
map((success) => (success ? "success" : "failed") as "success" | "failed"),
takeUntilDestroyed(destroyRef),
)
.subscribe({

View File

@@ -21,4 +21,17 @@ export const DISABLED_LOGGER: SemanticLogger = deepFreeze({
throw new Error(message);
}
},
panicWhen<T>(
predicate: boolean,
content: Jsonify<T> | string,
message?: string,
): predicate is false | never {
if (predicate) {
// type conversion safe because Jsonify<string> === string
this.panic(content as Jsonify<T | string>, message);
}
return !predicate;
},
});