Skip to content

Commit a3223ad

Browse files
committed
maybeSingle test
1 parent 2cf1b64 commit a3223ad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/index.test-d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
104104
expectType<{ username: string }[]>(data)
105105
}
106106

107+
// throw on error with maybeSingle is still nullable
108+
{
109+
const { data } = await postgrest.from('users').select('username').maybeSingle().throwOnError()
110+
expectType<{ username: string } | null>(data)
111+
}
112+
107113
// queries without throw on error have nullable results
108114
{
109115
const { data } = await postgrest.from('users').select('username')

0 commit comments

Comments
 (0)