mirror of
https://github.com/enricoros/big-AGI.git
synced 2026-05-10 21:50:14 -07:00
AttachmentDraftsStoreApi: improve typing
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import type { StoreApi } from 'zustand';
|
||||
import { createStore as createVanillaStore } from 'zustand/vanilla';
|
||||
|
||||
import { AttachmentsDraftsStore, createAttachmentDraftsStoreSlice } from './store-attachment-drafts_slice';
|
||||
import { AttachmentDraftsStoreApi, AttachmentsDraftsStore, createAttachmentDraftsStoreSlice } from './store-attachment-drafts_slice';
|
||||
|
||||
|
||||
export const createAttachmentDraftsVanillaStore = (): StoreApi<AttachmentsDraftsStore> => createVanillaStore<AttachmentsDraftsStore>()((...a) => ({
|
||||
export const createAttachmentDraftsVanillaStore = (): AttachmentDraftsStoreApi => createVanillaStore<AttachmentsDraftsStore>()((...a) => ({
|
||||
|
||||
// Attachments: attachment drafts
|
||||
...createAttachmentDraftsStoreSlice(...a),
|
||||
@@ -15,5 +14,5 @@ export const createAttachmentDraftsVanillaStore = (): StoreApi<AttachmentsDrafts
|
||||
// const _fallbackStoreApi = createPerChatVanillaStore();
|
||||
|
||||
// // usages: useAttachmentDrafts
|
||||
// export const useChatAttachmentsStore = <T, >(vanillaStore: Readonly<StoreApi<AttachmentsDraftsStore>> | null, selector: (store: AttachmentsDraftsStore) => T): T =>
|
||||
// export const useChatAttachmentsStore = <T, >(vanillaStore: Readonly<AttachmentDraftsStoreApi> | null, selector: (store: AttachmentsDraftsStore) => T): T =>
|
||||
// useStore(vanillaStore || fallbackStoreApi, selector);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { StoreApi, useStore } from 'zustand';
|
||||
import { createStore as createVanillaStore } from 'zustand/vanilla';
|
||||
|
||||
import { AttachmentsDraftsStore, createAttachmentDraftsStoreSlice } from '~/common/attachment-drafts/store-attachment-drafts_slice';
|
||||
import { AttachmentDraftsStoreApi, AttachmentsDraftsStore, createAttachmentDraftsStoreSlice } from '~/common/attachment-drafts/store-attachment-drafts_slice';
|
||||
|
||||
import { ComposerOverlayStore, createComposerOverlayStoreSlice } from './store-perchat-composer_slice';
|
||||
import { createEphemeralsOverlayStoreSlice, EphemeralsOverlayStore } from './store-perchat-ephemerals_slice';
|
||||
@@ -41,7 +41,7 @@ export const useChatOverlayStore = <T, >(vanillaStore: Readonly<StoreApi<PerChat
|
||||
useStore(vanillaStore || fallbackStoreApi, selector);
|
||||
|
||||
// usages: useAttachmentDrafts
|
||||
export const useChatAttachmentsStore = <T, >(vanillaStore: Readonly<StoreApi<AttachmentsDraftsStore>> | null, selector: (store: AttachmentsDraftsStore) => T): T =>
|
||||
export const useChatAttachmentsStore = <T, >(vanillaStore: Readonly<AttachmentDraftsStoreApi> | null, selector: (store: AttachmentsDraftsStore) => T): T =>
|
||||
useStore(vanillaStore || fallbackStoreApi, selector);
|
||||
|
||||
// usages: Composer
|
||||
|
||||
Reference in New Issue
Block a user