TaiwanVtuberData / TaiwanVTuberData.github.io

臺灣 VTuber 列表 Preact 實作網站原始碼
https://taiwanvtuberdata.github.io/
BSD 3-Clause "New" or "Revised" License
15 stars 1 forks source link

[Refactor] Adjust Data Type Nullability Presentation #131

Open nh60211as opened 5 months ago

nh60211as commented 5 months ago

Adjust imgUrl?: string to imgUrl: string | null to be more explicit regarding the nullability of the data field.

As-is:

export interface VTuberDisplayData {
  id: string;
  activity: Activity;
  name: string;
  imgUrl?: string;
  YouTubeId?: string;
  YouTubeSubscriber?: CountType;
  TwitchId?: string;
  TwitchFollower?: CountType;
  popularVideo?: VideoInfo;
  group?: string;
  nationality?: string;
  debutInfo: DebutInfo;
}

To-be:

export interface VTuberDisplayData {
  id: string;
  activity: Activity;
  name: string;
  imgUrl: string | null;
  YouTubeId: string | null;
  YouTubeSubscriber: CountType | null;
  TwitchId: string | null;
  TwitchFollower: CountType | null;
  popularVideo: VideoInfo | null;
  group: string | null;
  nationality: string | null;
  debutInfo: DebutInfo;
}