From c7569961e2d800ad3598a0072926ac732293fe7f Mon Sep 17 00:00:00 2001 From: TobyG74 Date: Sun, 10 Sep 2023 11:40:37 +0700 Subject: [PATCH] feat: tidying up the types --- src/types/index.ts | 73 ++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/src/types/index.ts b/src/types/index.ts index 450d614..6ad1e13 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,4 +1,4 @@ -export type DLResult = { +export interface DLResult { status: "success" | "error" message?: string result?: { @@ -6,21 +6,8 @@ export type DLResult = { id: string createTime: number description: string - author: { - username: string - nickname: string - signature: string - birthday: string - region: string - } - statistics: { - playCount: number - downloadCount: number - shareCount: number - commentCount: number - likeCount: number - favoriteCount: number - } + author: Author + statistics: Statistics video?: string[] cover?: string[] dynamic_cover?: string[] @@ -29,24 +16,46 @@ export type DLResult = { } } -export type StalkResult = { +export interface Author { + uid: number + username: string + nickname: string + signature: string + birthday: string + region: string +} + +export interface Statistics { + playCount: number + downloadCount: number + shareCount: number + commentCount: number + likeCount: number + favoriteCount: number +} + +export interface StalkResult { status: "success" | "error" message?: string result?: { - users: { - username: string - nickname: string - avatar: string - signature: string - verified: boolean - region: string - } - stats: { - followerCount: number - followingCount: number - heartCount: number - videoCount: number - likeCount: number - } + users: Users + stats: Stats } } + +export interface Users { + username: string + nickname: string + avatar: string + signature: string + verified: boolean + region: string +} + +export interface Stats { + followerCount: number + followingCount: number + heartCount: number + videoCount: number + likeCount: number +}