diff --git a/src/routes/projects_new/[projectId]/vbranches.ts b/src/routes/projects_new/[projectId]/vbranches.ts index 589be26c5..c85cf06e0 100644 --- a/src/routes/projects_new/[projectId]/vbranches.ts +++ b/src/routes/projects_new/[projectId]/vbranches.ts @@ -3,13 +3,12 @@ import { Branch } from './types'; import { stores } from '$lib'; import { writable, type Loadable, Value } from 'svelte-loadable-store'; import { plainToInstance } from 'class-transformer'; -import type { Subscriber, Unsubscriber, Writable } from '@square/svelte-store'; +import type { Writable, Readable } from '@square/svelte-store'; import { error } from '$lib/toasts'; -const cache: Map = new Map(); +const cache: Map>> = new Map(); export interface VirtualBranchStore { - subscribe: (branches: Subscriber>) => Unsubscriber; refresh: () => void; setTarget: (branch: string) => Promise; createBranch: (name: string, path: string) => Promise; @@ -19,14 +18,14 @@ export interface VirtualBranchStore { moveFiles: (branchId: string, paths: Array) => Promise; } -export function getStore(projectId: string): VirtualBranchStore { +export function getStore(projectId: string): VirtualBranchStore & Readable> { const cachedStore = cache.get(projectId); if (cachedStore) { return cachedStore; } const writeable = createWriteable(projectId); - const store: VirtualBranchStore = { + const store: VirtualBranchStore & Readable> = { subscribe: writeable.subscribe, refresh: () => refresh(projectId, writeable), setTarget(branch) {