diff --git a/js/actionCreators/playlist.ts b/js/actionCreators/playlist.ts index b5185fac..8e9561d6 100644 --- a/js/actionCreators/playlist.ts +++ b/js/actionCreators/playlist.ts @@ -28,6 +28,8 @@ export function cropPlaylist(): Dispatchable { } = getState(); dispatch({ type: REMOVE_TRACKS, + // @ts-ignore The keys are numbers, but TypeScript does not trust us. + // https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 ids: Object.keys(tracks).filter(id => !tracks[id].selected) }); }; @@ -40,6 +42,8 @@ export function removeSelectedTracks(): Dispatchable { } = getState(); dispatch({ type: REMOVE_TRACKS, + // @ts-ignore The keys are numbers, but TypeScript does not trust us. + // https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 ids: Object.keys(tracks).filter(id => tracks[id].selected) }); }; diff --git a/js/types.ts b/js/types.ts index cbe039d9..2afc18b0 100644 --- a/js/types.ts +++ b/js/types.ts @@ -426,6 +426,8 @@ export interface PlaylistTrack { export interface PlaylistState { trackOrder: number[]; + // https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 + // TODO: Using numbers for keys is kinda annoying. Consider retyping as string tracks: { [id: number]: PlaylistTrack }; lastSelectedIndex: number | null; currentTrack: number | null;