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

fix: return correct types instead of casting with as #116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iamrgroot
Copy link

@iamrgroot iamrgroot commented Jun 20, 2024

BREAKING CHANGE: This changes the return type of all endpoints during development, as they can now return undefined in Typescript land

Summary

The makeRequest function in the SpotifyApi class has a return type of Promise<TReturnType>, but it can and will return Promise<null> in some cases

Changes

This can cause exceptions when using the SDK. So this PR fixes this to use the actual type Promise<TReturnType|null>, so these errors can be caught during the type check in development.

Results

No actual changes in behaviour, just in the Typescript types

changed all incorrect casting using as with the actual return types

BREAKING CHANGE: This changes all endpoints during development, as they can now return undefined in
Typescript land
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

1 participant