-
-
Notifications
You must be signed in to change notification settings - Fork 160
chore: Types improvements. #122
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @thorwebdev, didn't occur to me to just cast the result of single
...
Co-authored-by: Bobbie Soedirgo <[email protected]>
@@ -68,8 +68,8 @@ export default class PostgrestTransformBuilder<T> extends PostgrestBuilder<T> { | |||
* Retrieves only one row from the result. Result must be one row (e.g. using | |||
* `limit`), otherwise this will result in an error. | |||
*/ | |||
single(): PostgrestTransformBuilder<T> { | |||
single(): PromiseLike<PostgrestSingleResponse<T>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol wtf
Nice one Thor, Bobbie! Team work makes the dream work |
🎉 This PR is included in version 0.21.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
r? @soedirgo @kiwicopple (I might need some help with updating the test snapshots)
What kind of change does this PR introduce?
PostgrestResponse
data always an arrayPostgrestSingleResponse
and makesingle
returnPromiseLike<PostgrestSingleResponse<T>>
single
has to be called at the very end of the method chain in a TypeScript context.PostgrestResponse
is correctly assigned as the return type ofonfulfilled
callback.Additional context
I've tested this in a TypeScript project:
