Skip to content

Typings for spotify-api #190

Open
Open
@half2me

Description

@half2me

This is probably just me not knowing typescript enough, but I've been trying now for hours unsuccessfully.

I want to type a variable to SpotifyApi.TrackObjectFull[]

Basically after calling this.spotify.getTracks(...), I'm assigning the result to a variable, and I need to type it. In my IDE, I can see the return type of the function is a Promise<SpotifyApi.MultipleTracksResponse> inside of which is the tracks key, which has the type: TrackObjectFull[];

All I would like to do is to be able to define my variable like so:

let myTrack: TrackObjectFull[]

However I'm unable to resolve this type from anywhere. Its doesn't seem to be exported from the 'spotify-web-api-js' module. I even tried npm i --save-dev @types/spotify-api to see if I could import it somehow from there, but when I try to import it, it says its not a module.
I can see that the IDE picks up on the type, but I really need to use it as well. What do I need to import for it to work?

Thank you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions