-
-
Notifications
You must be signed in to change notification settings - Fork 260
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
TypeScript: getUserPlaylists()
ignores options
when userId
is undefined
#181
Comments
baizel
added a commit
to baizel/spotify-web-api-js
that referenced
this issue
Aug 11, 2021
This issue was raised in JMPerez#181 but not yet fixed. This fork fixes this issue
+1 to get this fixed |
schl3ck
added a commit
to schl3ck/spotify-web-api-scriptable
that referenced
this issue
Jan 3, 2022
tkhduracell
added a commit
to tkhduracell/spotify-web-api-js
that referenced
this issue
Feb 15, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In TypeScript, when calling
getUserPlaylists()
, the options object is ignored whenuserId
is passed as undefined.This is because the method
getUserPlaylists()
has dynamic behaviour, re-assigning its arguments if the first argument is not a string. The current types forgetUserPlaylists()
don't reflect this beahviour.Code in question:
Types:
Possible fix
You could fix the types by overloading the function signature.
You could also make the types more accurate by using an interface instead of the catch-all
Object
type for the options, and distinguishing between the Promise-returning and callback versions of the method.The text was updated successfully, but these errors were encountered: