fix: type hiint dispatch stateupdater
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Tr, langCodeContext, LANG_OPTIONS } from "./translate";
|
import { Tr, langCodeContext, LANG_OPTIONS } from "./translate";
|
||||||
import structuredClone from "@ungap/structured-clone";
|
import structuredClone from "@ungap/structured-clone";
|
||||||
import { createRef } from "preact";
|
import { createRef } from "preact";
|
||||||
import { StateUpdater, useEffect, useState } from "preact/hooks";
|
import { StateUpdater, useEffect, useState, Dispatch } from "preact/hooks";
|
||||||
import {
|
import {
|
||||||
ChatStore,
|
ChatStore,
|
||||||
ChatStoreMessage,
|
ChatStoreMessage,
|
||||||
@@ -55,7 +55,7 @@ export default function ChatBOX(props: {
|
|||||||
chatStore: ChatStore;
|
chatStore: ChatStore;
|
||||||
setChatStore: (cs: ChatStore) => void;
|
setChatStore: (cs: ChatStore) => void;
|
||||||
selectedChatIndex: number;
|
selectedChatIndex: number;
|
||||||
setSelectedChatIndex: StateUpdater<number>;
|
setSelectedChatIndex: Dispatch<StateUpdater<number>>;
|
||||||
}) {
|
}) {
|
||||||
const { chatStore, setChatStore } = props;
|
const { chatStore, setChatStore } = props;
|
||||||
// prevent error
|
// prevent error
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Tr, langCodeContext, LANG_OPTIONS, tr } from "./translate";
|
import { Tr, langCodeContext, LANG_OPTIONS, tr } from "./translate";
|
||||||
import { useState, useEffect, StateUpdater } from "preact/hooks";
|
import { useState, useEffect, StateUpdater,Dispatch } from "preact/hooks";
|
||||||
import { ChatStore, ChatStoreMessage } from "./app";
|
import { ChatStore, ChatStoreMessage } from "./app";
|
||||||
import { calculate_token_length, getMessageText } from "./chatgpt";
|
import { calculate_token_length, getMessageText } from "./chatgpt";
|
||||||
import { isVailedJSON } from "./message";
|
import { isVailedJSON } from "./message";
|
||||||
@@ -9,7 +9,7 @@ import { EditMessageDetail } from "./editMessageDetail";
|
|||||||
interface EditMessageProps {
|
interface EditMessageProps {
|
||||||
chat: ChatStoreMessage;
|
chat: ChatStoreMessage;
|
||||||
chatStore: ChatStore;
|
chatStore: ChatStore;
|
||||||
setShowEdit: StateUpdater<boolean>;
|
setShowEdit: Dispatch<StateUpdater<boolean>>;
|
||||||
setChatStore: (cs: ChatStore) => void;
|
setChatStore: (cs: ChatStore) => void;
|
||||||
}
|
}
|
||||||
export function EditMessage(props: EditMessageProps) {
|
export function EditMessage(props: EditMessageProps) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { IDBPDatabase } from "idb";
|
import { IDBPDatabase } from "idb";
|
||||||
import { ChatStore } from "./app";
|
import { ChatStore } from "./app";
|
||||||
import { StateUpdater, useRef, useState } from "preact/hooks";
|
import { StateUpdater, useRef, useState, Dispatch } from "preact/hooks";
|
||||||
|
|
||||||
interface ChatStoreSearchResult {
|
interface ChatStoreSearchResult {
|
||||||
key: IDBValidKey;
|
key: IDBValidKey;
|
||||||
@@ -11,7 +11,7 @@ interface ChatStoreSearchResult {
|
|||||||
|
|
||||||
export default function Search(props: {
|
export default function Search(props: {
|
||||||
db: Promise<IDBPDatabase<ChatStore>>;
|
db: Promise<IDBPDatabase<ChatStore>>;
|
||||||
setSelectedChatIndex: StateUpdater<number>;
|
setSelectedChatIndex: Dispatch<StateUpdater<number>>;
|
||||||
chatStore: ChatStore;
|
chatStore: ChatStore;
|
||||||
setShow: (show: boolean) => void;
|
setShow: (show: boolean) => void;
|
||||||
}) {
|
}) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { createRef } from "preact";
|
import { createRef } from "preact";
|
||||||
import { StateUpdater, useContext, useEffect, useState } from "preact/hooks";
|
import { StateUpdater, useContext, useEffect, useState, Dispatch } from "preact/hooks";
|
||||||
import {
|
import {
|
||||||
ChatStore,
|
ChatStore,
|
||||||
TemplateAPI,
|
TemplateAPI,
|
||||||
@@ -414,7 +414,7 @@ const Choice = (props: {
|
|||||||
export default (props: {
|
export default (props: {
|
||||||
chatStore: ChatStore;
|
chatStore: ChatStore;
|
||||||
setChatStore: (cs: ChatStore) => void;
|
setChatStore: (cs: ChatStore) => void;
|
||||||
setShow: StateUpdater<boolean>;
|
setShow: Dispatch<StateUpdater<boolean>>;
|
||||||
selectedChatStoreIndex: number;
|
selectedChatStoreIndex: number;
|
||||||
templates: TemplateChatStore[];
|
templates: TemplateChatStore[];
|
||||||
setTemplates: (templates: TemplateChatStore[]) => void;
|
setTemplates: (templates: TemplateChatStore[]) => void;
|
||||||
|
|||||||
Reference in New Issue
Block a user