diff --git a/packages/frontend-core/src/components/grid/lib/events.js b/packages/frontend-core/src/components/grid/lib/events.ts similarity index 78% rename from packages/frontend-core/src/components/grid/lib/events.js rename to packages/frontend-core/src/components/grid/lib/events.ts index 1c486858b2..7fd826954a 100644 --- a/packages/frontend-core/src/components/grid/lib/events.js +++ b/packages/frontend-core/src/components/grid/lib/events.ts @@ -2,11 +2,11 @@ import { createEventDispatcher } from "svelte" export const createEventManagers = () => { const svelteDispatch = createEventDispatcher() - let subscribers = {} + let subscribers: Record void)[]> = {} // Dispatches an event, notifying subscribers and also emitting a normal // svelte event - const dispatch = (event, payload) => { + const dispatch = (event: string, payload: any) => { svelteDispatch(event, payload) const subs = subscribers[event] || [] for (let i = 0; i < subs.length; i++) { @@ -15,7 +15,7 @@ export const createEventManagers = () => { } // Subscribes to events - const subscribe = (event, callback) => { + const subscribe = (event: string, callback: () => void) => { const subs = subscribers[event] || [] subscribers[event] = [...subs, callback] diff --git a/packages/frontend-core/src/components/grid/stores/index.ts b/packages/frontend-core/src/components/grid/stores/index.ts index 1b5e2a48c1..422b264473 100644 --- a/packages/frontend-core/src/components/grid/stores/index.ts +++ b/packages/frontend-core/src/components/grid/stores/index.ts @@ -79,6 +79,8 @@ export interface BaseStore { API: APIClient gridID: string props: Writable + subscribe: any + dispatch: (event: string, data: any) => any } export type Store = BaseStore & @@ -93,11 +95,8 @@ export type Store = BaseStore & Filter.Store & UI.Store & Clipboard.Store & - Scroll.Store & { - // TODO while typing the rest of stores - subscribe: any - dispatch: (event: string, data: any) => any - } & Rows.Store & + Scroll.Store & + Rows.Store & Reorder.Store & Resize.Store & Config.Store &