Closed soedirgo closed 1 year ago
:tada: This PR is included in version 1.3.1 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
oof, i was wondering why all my types got borked overnight.
Sorry about that @natedunn - do you mind sharing how it's breaking your types? While we consider it a bug here we do want to make sure the fix isn't causing more issues at least.
@soedirgo Yeah I can understand the mentality there, so no worries.
There's not much to describe in terms of my issues. The PR description laid it out pretty well, so I knew what I had to change:
This stopped working
.returns<SomeDefinedType>()
And this fixed the issue
.returns<SomeDefinedType[]>()
I created this issue: https://github.com/supabase/postgrest-js/issues/430
It is probably related to this.
What kind of change does this PR introduce?
Fixes #387.
RPC return types aren't getting propagated properly. E.g. if a function returns
boolean
, thedata
will be typed asboolean[]
.To fix this, we change PostgrestBuilder's type parameter to be the actual type of
data
, instead of the element type ofdata
(which assumesdata
is always an array, which is incorrect).In doing so we effectively remove all usage of
PostgrestResponse
andPostgrestMaybeSingleResponse
. We can stop exporting these on the next major version.This also fixes the behavior of
.returns<NewResult>()
, which was inconsistent with the documentation (i.e.data
was typed asNewResult[]
instead ofNewResult
).