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

Add function overloading for typings in getUserPlaylists - Fixes #135 #156

Merged
merged 1 commit into from
Apr 19, 2020

Conversation

JMPerez
Copy link
Owner

@JMPerez JMPerez commented Apr 19, 2020

The getUserPlaylists function checks if the first parameter is a string, in which case it uses it as the userId, otherwise it assumes the request is for the current user and considers the input parameters as options and callback.

Passing undefined as userId assumes that the first parameter is options, but the code removes the first parameter.

Typescript supports the definition for function overloading, which is what's needed here https://www.typescriptlang.org/docs/handbook/functions.html#overloads

@coveralls
Copy link

coveralls commented Apr 19, 2020

Coverage Status

Coverage remained the same at 98.396% when pulling 16432e5 on getUserPlaylists-typings into 0fa940e on master.

@JMPerez JMPerez merged commit 923ffb1 into master Apr 19, 2020
@JMPerez JMPerez deleted the getUserPlaylists-typings branch April 19, 2020 06:42
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

Successfully merging this pull request may close these issues.

None yet

2 participants