1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-04 03:46:19 +02:00

refactor(frontend): better type defs

This commit is contained in:
syuilo
2025-05-22 13:05:28 +09:00
parent 74c857e23d
commit e4db9b64df
3 changed files with 14 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ export type PagingCtx<E extends keyof Misskey.Endpoints = keyof Misskey.Endpoint
canFetchDetection?: 'safe' | 'limit';
};
export function usePagination<Endpoint extends keyof Misskey.Endpoints, T = Misskey.Endpoints[Endpoint]['res'] extends (infer I)[] ? I : never>(props: {
export function usePagination<Endpoint extends keyof Misskey.Endpoints, T extends { id: string; } = (Misskey.Endpoints[Endpoint]['res'] extends (infer I)[] ? I extends { id: string } ? I : { id: string } : { id: string })>(props: {
ctx: PagingCtx<Endpoint>;
autoInit?: boolean;
autoReInit?: boolean;