forked from mirrors/misskey
refactor(frontend): better type def of usePagination
This commit is contained in:
@@ -37,8 +37,8 @@ export type PagingCtx<E extends keyof Misskey.Endpoints = keyof Misskey.Endpoint
|
|||||||
direction?: 'newer' | 'older';
|
direction?: 'newer' | 'older';
|
||||||
};
|
};
|
||||||
|
|
||||||
export function usePagination<T extends MisskeyEntity>(props: {
|
export function usePagination<Endpoint extends keyof Misskey.Endpoints, T = Misskey.Endpoints[Endpoint]['res'] extends (infer I)[] ? I : never>(props: {
|
||||||
ctx: PagingCtx;
|
ctx: PagingCtx<Endpoint>;
|
||||||
useShallowRef?: boolean;
|
useShallowRef?: boolean;
|
||||||
}) {
|
}) {
|
||||||
const items = props.useShallowRef ? shallowRef<T[]>([]) : ref<T[]>([]);
|
const items = props.useShallowRef ? shallowRef<T[]>([]) : ref<T[]>([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user