Skip to content

Commit c873254

Browse files
committed
fix: improve entity type
1 parent 2f1cf52 commit c873254

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

src/client/client.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ import { JikeUser } from './user'
99
import { fetchPaginated } from './utils/paginate'
1010
import { AuthorizationError } from './errors/AuthorizationError'
1111
import { JikePost } from './post'
12-
import type { PersonalUpdate } from '../types/api-responses'
12+
import type { FollowingUpdatesMoreKey, JikeClientJSON } from './types'
1313
import type { CreatePostOption, PostType } from '../types/options'
1414
import type { FollowingUpdate, Notification } from '../types/entity'
1515
import type { BeforeRetryState } from 'ky/distribution/types/hooks'
1616
import type { PaginatedFetcher, PaginatedOption } from './utils/paginate'
1717
import type { Api } from '../api'
1818
import type { ApiConfig, ApiConfigResolved } from '../request'
1919

20-
type FollowingUpdatesMoreKey = PersonalUpdate.FollowingUpdatesResponseMoreKey
21-
2220
interface EventMap {
2321
renewToken: () => void
2422
}
2523

24+
export type { JikeClientJSON }
25+
2626
export class JikeClient extends EventEmitter<EventMap> {
2727
#refreshToken: string
2828
#config: ApiConfigResolved
@@ -335,10 +335,3 @@ export class JikeClient extends EventEmitter<EventMap> {
335335
return this.fromJSON(json)
336336
}
337337
}
338-
339-
export interface JikeClientJSON extends Omit<ApiConfigResolved, 'beforeRetry'> {
340-
refreshToken: string
341-
userId: string
342-
username: string
343-
screenName: string
344-
}

src/client/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { ApiConfigResolved } from '../request'
2+
import type { PersonalUpdate } from '../types/api-responses'
3+
4+
export interface JikeClientJSON extends Omit<ApiConfigResolved, 'beforeRetry'> {
5+
refreshToken: string
6+
userId: string
7+
username: string
8+
screenName: string
9+
}
10+
11+
export type FollowingUpdatesMoreKey =
12+
PersonalUpdate.FollowingUpdatesResponseMoreKey

src/types/entity/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export interface CommonImage {
33
smallPicUrl: string
44
middlePicUrl: string
55
picUrl: string
6-
/** 格式,如 `jpeg` */
6+
/** 格式,如 `jpeg`, `heic` */
77
format: string
88
}
99

src/types/entity/other.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export interface PostDetail {
2424
commentCount: number
2525
repostCount: number
2626
shareCount: number
27-
pictures: any[]
27+
pictures: Picture[]
2828
collected: boolean
29-
collectTime?: any
29+
collectTime?: string
3030
user: User
3131
createdAt: string
3232
isFeatured: boolean
@@ -58,7 +58,7 @@ export interface Target {
5858
likeCount: number
5959
shareCount: number
6060
rootType: string
61-
pictures: any[]
61+
pictures: Picture[]
6262
createdAt: string
6363
liked: boolean
6464
collected: boolean

0 commit comments

Comments
 (0)