mirror of
https://github.com/bitwarden/browser
synced 2026-02-05 19:23:19 +00:00
fix type errors
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user