File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ export type LimitOption<K extends keyof LimitOptionAll> = Pick<
1111>
1212
1313export type LimitFn <
14- T ,
15- K extends keyof LimitOptionAll = keyof LimitOptionAll
14+ K extends keyof LimitOptionAll = keyof LimitOptionAll ,
15+ T = any
1616> = ( opt : LimitOption < K > , item : T , data : T [ ] ) => boolean
1717
1818export const limitMaxCount =
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export interface PaginatedOption<
55 L extends keyof LimitOptionAll = keyof LimitOptionAll ,
66 K = unknown
77> {
8- limit ?: LimitFn < T , L | 'total' >
8+ limit ?: LimitFn < L | 'total' , T >
99 /**
1010 * 当获取下一页时触发,返回 false 将停止获取下一页
1111 */
Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from 'vitest'
2+ import { JikeClient , limit } from '../../src'
3+ import { config , refreshToken } from '../config'
4+
5+ describe ( 'notifications should work' , ( ) => {
6+ const client = new JikeClient ( { ...config , refreshToken } )
7+
8+ it ( 'queryNotifications should work' , async ( ) => {
9+ const notifications = await client . queryNotifications ( {
10+ limit : limit . limitMaxCount ( 100 ) ,
11+ } )
12+ expect ( notifications . length ) . toBe ( 100 )
13+ } )
14+ } )
You can’t perform that action at this time.
0 commit comments