Closed chris-at-fabius-labs closed 1 year ago
I am able to work-around this issue by calling data.flat(1)
, which has no real effect on the already-flat array, but satisfies TypeScript's type-checker that the array is definitely 1-dimensional.
Can you try npm update @supabase/postgrest-js
(it's a dependency of supabase-js)? There was an issue with how .rpc()
return types are handled, but it needs an update on both the CLI (which seems to be up-to-date here) and the client library.
Closing this now, but let us know if updating the client library doesn't resolve it.
Confirmed that updating @supabase/postgrest-js
resolved the issue. Thank you!
Bug report
Describe the bug
Using supabase-js@2.8.0, when I call a database function that is supposed to return an array of records, the typing of the data incorrectly appears as an array of arrays of records, but is actually just an array of records.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
data
property of response object is typed as a 2-dimensional array:console.log(data)
, it prints as a 1-dimensional array.Expected behavior
The type of the
data
property on the RPC response object should be correct.System information