refactor(frontend): better type def of usePagination

This commit is contained in:
syuilo 2025-05-10 14:42:18 +09:00
parent 92aca4498b
commit 039aacb31f
1 changed files with 2 additions and 2 deletions

View File

@ -37,8 +37,8 @@ export type PagingCtx<E extends keyof Misskey.Endpoints = keyof Misskey.Endpoint
direction?: 'newer' | 'older';
};
export function usePagination<T extends MisskeyEntity>(props: {
ctx: PagingCtx;
export function usePagination<Endpoint extends keyof Misskey.Endpoints, T = Misskey.Endpoints[Endpoint]['res'] extends (infer I)[] ? I : never>(props: {
ctx: PagingCtx<Endpoint>;
useShallowRef?: boolean;
}) {
const items = props.useShallowRef ? shallowRef<T[]>([]) : ref<T[]>([]);