Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings for spotify-api #190

Open
half2me opened this issue Dec 20, 2020 · 1 comment
Open

Typings for spotify-api #190

half2me opened this issue Dec 20, 2020 · 1 comment

Comments

@half2me
Copy link

half2me commented Dec 20, 2020

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.

@snigle
Copy link

snigle commented Jun 28, 2021

Hello, I had the same issue and I found typescript lib :
https://github.com/adamgrieger/spotify-web-api-ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants