Open barnacker opened 8 months ago
How would one go about typing the object returned by: https://feathers-pinia.pages.dev/services/use-get.html#returned-object
I was planning to do something like:
const myStuff: UseGetResult = myService.useGet(id)
And then I would dig as needed depending on the case.
I looked into the code and found that the returned object didnt have an interface such as:
useGet(id: MaybeRef<Id | null>, params?: MaybeRef<UseGetParams>): UseGetResult
But currently is implemented this way:
useGet(id: MaybeRef<Id | null>, params?: MaybeRef<UseGetParams>): { params: UseGetParams; isSsr: boolean; data: SvcModel<Svc> | null; ids: Id[]; getFromStore: any; get: () => Promise<AnyData>; request: { then: <TResult1 = AnyData, TResult2 = never>(onfulfilled?: ((value: AnyData) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined) => Promise<TResult1 | TResult2>; catch: <TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined) => Promise<AnyData | TResult>; finally: (onfinally?: (() => void) | null | undefined) => Promise<AnyData>; readonly [Symbol.toStringTag]: string; } | null; requestCount: number; queryWhen: (_queryWhenFn: () => boolean) => void; isPending: boolean; hasBeenRequested: boolean; hasLoaded: boolean; error: any; clearError: () => null; };
How would one go about typing the object returned by: https://feathers-pinia.pages.dev/services/use-get.html#returned-object
I was planning to do something like:
And then I would dig as needed depending on the case.
I looked into the code and found that the returned object didnt have an interface such as:
But currently is implemented this way: