Skip to content

Commit e4bf064

Browse files
committed
fix(jike-client): LimitFn type
1 parent 40cd1f0 commit e4bf064

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

src/client/utils/limit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export type LimitOption<K extends keyof LimitOptionAll> = Pick<
1111
>
1212

1313
export 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

1818
export const limitMaxCount =

src/client/utils/paginate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
*/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
})

0 commit comments

Comments
 (0)