mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-28 04:47:42 +03:00
Fix a couple of typing issues
- errors thrown by an observable are of `any` kind - make a few fields readonly
This commit is contained in:
parent
c22a29e432
commit
3ab3c9cb1f
@ -21,7 +21,7 @@ export function storeToObservable<T>(svelteStore: Writable<T> | Readable<T>): Ob
|
||||
*/
|
||||
export function observableToStore<T>(
|
||||
observable: Observable<T>
|
||||
): [Readable<T | undefined>, Readable<string | undefined>] {
|
||||
): [Readable<T | undefined>, Readable<any | undefined>] {
|
||||
const error = writable<any>();
|
||||
const store = writable<T | undefined>(undefined, () => {
|
||||
// This runs when the store is first subscribed to
|
||||
|
@ -10,10 +10,10 @@ import { BehaviorSubject, Observable, Subject, distinct, map, merge, shareReplay
|
||||
import type { Readable } from 'svelte/motion';
|
||||
|
||||
export class UserService {
|
||||
readonly reset$ = new Subject<User | undefined>();
|
||||
readonly loading$ = new BehaviorSubject(false);
|
||||
private reset$ = new Subject<User | undefined>();
|
||||
private loading$ = new BehaviorSubject(false);
|
||||
|
||||
readonly user$ = merge(
|
||||
private user$ = merge(
|
||||
new Observable<User | undefined>((subscriber) => {
|
||||
invoke<User | undefined>('get_user').then((userData) => {
|
||||
if (userData) {
|
||||
@ -32,8 +32,8 @@ export class UserService {
|
||||
distinct()
|
||||
);
|
||||
|
||||
user: Readable<User | undefined>;
|
||||
error: Readable<string | undefined>;
|
||||
readonly user: Readable<User | undefined>;
|
||||
readonly error: Readable<string | undefined>;
|
||||
|
||||
constructor(private cloud: CloudClient) {
|
||||
[this.user, this.error] = observableToStore(this.user$);
|
||||
|
Loading…
Reference in New Issue
Block a user