Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

spotify-web-api-ts-sdk search compilation error, expected 0 arguments got 2

spotify-web-api-ts-sdk search compilation error, expected 0 arguments got 2

typescript is giving an inaccurate compilation error for use of spotify-web-api-ts-sdk, `expected 0 arguments, but got 2` for `SpotifyApi`.`search` from spotify-web-api-ts-sdk. Note that in the screenshot, the `search` function is defined with arguments as expected (see the console output), the request is actually being made (see the network tab and `initiator` column), and the results are even being rendered (if you can see behind the compilation error overlay to the webpage behind). can anyone help me figure out why typescript is wrongly giving this compilation error?

image.png
Reply
1 Reply

I'm running into this issue as well, I'm trying to build a simple React app.
I found that forcibly updating the version of Typescript being used seems to fix the issue. The latest version of `react-scripts` has a peer dependency of `typescript@"^3.2.1 || ^4"`, so npm will complain when you try to install Typescript 5, but it seems to work okay.

 

I don't know what the issue with Typescript 4.9 is, but I'm guessing that spotify-web-api-ts-sdk is using a feature that requires Typescript 5 to compile correctly.

 

Suggested posts

Type a product name