https://supabase.com/ logo
#help
Title
# help
u

(d,f,g)=> 🥁

05/30/2022, 11:40 PM
i have an rpc call that returns a json object, the TS types seem to force that an rpc call will return an array of whatever is given to the generic? is there something i'm doing wrong or is there a way around this?
Copy code
js
const { data } = await supabase.rpc<Record<string, number>>('comments_stats')
data here is
Record<string, number>[] | null
n

Needle

05/30/2022, 11:40 PM
Hello @(d,f,g)=> 🥁! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
🆕 TS type for RPC calls is always an array?
u

(d,f,g)=> 🥁

05/30/2022, 11:46 PM
workaround for now is to
return data as unknown as Record<string, number>
but it would be ideal not to enforce that an rpc call always returns an array
n

Needle

05/31/2022, 11:55 PM
🆕 order by on a stored precedure?
🆕 TS type for RPC calls is always an array?