Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Conversation

thorwebdev
Copy link
Contributor

r? @soedirgo @kiwicopple (I might need some help with updating the test snapshots)

What kind of change does this PR introduce?

  • Make PostgrestResponse data always an array
  • Introduce PostgrestSingleResponse and make single return PromiseLike<PostgrestSingleResponse<T>>
    • This means single has to be called at the very end of the method chain in a TypeScript context.
  • Make sure PostgrestResponse is correctly assigned as the return type of onfulfilled callback.

Additional context

I've tested this in a TypeScript project:
image

@thorwebdev
Copy link
Contributor Author

image
Ah damn /o\

Copy link
Member

@soedirgo soedirgo left a 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 <bobbie@soedirgo.dev>
* `limit`), otherwise this will result in an error.
*/
single(): PostgrestTransformBuilder<T> {
single(): PromiseLike<PostgrestSingleResponse<T>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol wtf

@kiwicopple
Copy link
Member

Nice one Thor, Bobbie! Team work makes the dream work

@kiwicopple kiwicopple merged commit 9f40170 into master Oct 21, 2020
@github-actions
Copy link

🎉 This PR is included in version 0.21.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@soedirgo soedirgo deleted the thor/types-improvements branch June 20, 2021 08:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants