From 614d5f0ca06dee2bdc9576a1024c34f35fddb7e5 Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Mon, 17 Sep 2018 08:46:23 -0700 Subject: [PATCH] Improve typing of PlaylistTrack --- js/config.ts | 4 ++-- js/reducers/playlist.ts | 2 +- js/types.ts | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/js/config.ts b/js/config.ts index 1c41b153..6f806199 100644 --- a/js/config.ts +++ b/js/config.ts @@ -5,8 +5,8 @@ import { DeepPartial } from "redux"; interface Config { initialTracks?: Track[]; - audioUrl?: string | URL; - skinUrl?: string | URL; + audioUrl?: string; + skinUrl?: string; disableMarquee?: boolean; initialState?: DeepPartial; } diff --git a/js/reducers/playlist.ts b/js/reducers/playlist.ts index daa7578d..b7bffe32 100644 --- a/js/reducers/playlist.ts +++ b/js/reducers/playlist.ts @@ -173,7 +173,7 @@ const playlist = ( [action.id]: { id: action.id, selected: false, - defaultName: action.defaultName, + defaultName: action.defaultName || null, duration: action.duration == null ? null : action.duration, url: action.url, mediaTagsRequestStatus: MEDIA_TAG_REQUEST_STATUS.NOT_REQUESTED diff --git a/js/types.ts b/js/types.ts index 2b5e58b5..94b95c89 100644 --- a/js/types.ts +++ b/js/types.ts @@ -97,7 +97,7 @@ export type Action = id: number; defaultName?: string; duration?: number; - url: string | URL; + url: string; } | { type: "SET_MEDIA"; @@ -461,7 +461,7 @@ export interface URLTrack extends TrackInfo { * * Example: `'https://example.com/song.mp3'` */ - url: string | URL; + url: string; } export interface BlobTrack extends TrackInfo { @@ -479,10 +479,11 @@ export interface BlobTrack extends TrackInfo { export type Track = URLTrack | BlobTrack; export interface PlaylistTrack { - artist: string; - title: string; + id: number; + artist?: string; + title?: string; url: string; - defaultName: string; + defaultName: string | null; albumArtUrl?: string | null; selected: boolean; mediaTagsRequestStatus: MediaTagRequestStatus;