Skip to content

Commit

Permalink
fix(request): declare type for giving value to ref (#141)
Browse files Browse the repository at this point in the history
  • Loading branch information
j10ccc authored Oct 22, 2024
1 parent 02684e9 commit 6e11aa2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/useRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import Taro from "@tarojs/taro";
import { onMounted, ref, shallowRef } from "vue";
import { onMounted, Ref, ref, shallowRef } from "vue";

interface RequestConfigType<TData extends TaroGeneral.IAnyObject, TParams> {
/** 是否手动发起请求 */
Expand Down Expand Up @@ -131,8 +131,8 @@ export function useRequestNext<State, Params extends Record<string, any>>(
onError
} = options ?? {};

const loading = ref(false);
const data = ref(initialData);
const loading = ref(false) as Ref<boolean>;
const data = ref(initialData) as Ref<State>;
const error = shallowRef<unknown | undefined>(undefined);

async function run(params?: Params) {
Expand Down

0 comments on commit 6e11aa2

Please sign in to comment.