Ignore issue with Object.keys always returning string[]

This commit is contained in:
Jordan Eldredge 2018-09-17 08:32:52 -07:00
parent 8b2e2dd142
commit 342ac3dac9
2 changed files with 6 additions and 0 deletions

View file

@ -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)
});
};

View file

@ -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;