diff --git a/types/spotify-web-playback-sdk/index.d.ts b/types/spotify-web-playback-sdk/index.d.ts index b79a46f632..e3ec73e57b 100644 --- a/types/spotify-web-playback-sdk/index.d.ts +++ b/types/spotify-web-playback-sdk/index.d.ts @@ -4,6 +4,7 @@ // Marcus Weiner // Moritz Gunz // Daniel Almaguer +// Hanna Becker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 @@ -33,7 +34,9 @@ declare namespace Spotify { type ErrorTypes = 'account_error' | 'authentication_error' | 'initialization_error' | 'playback_error'; interface Image { + height?: number | null; url: string; + width?: number | null; } interface PlaybackContext { diff --git a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts index 692a062971..0d80e24fd8 100644 --- a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts +++ b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts @@ -32,6 +32,10 @@ player.getCurrentState().then((playbackState: Spotify.PlaybackState | null) => { if (playbackState) { const { current_track, next_tracks } = playbackState.track_window; const repeatMode: 0 | 1 | 2 = playbackState.repeat_mode; + const images = current_track.album.images; + if (images.length) { + const { 0: { height, width } } = images; + } console.log("Currently Playing", current_track); console.log("Playing Next", next_tracks[0]);