Skip to content

Commit 226ae2d

Browse files
committed
chore: add inner test case
1 parent eecc4e6 commit 226ae2d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

test/override-types.test-d.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,43 @@ const postgrest = new PostgrestClient<Database>(REST_URL)
395395
>
396396
>(true)
397397
}
398+
399+
// Test overrideTypes deep nesting with embedded inner relation
400+
{
401+
const result = await postgrest
402+
.from('users')
403+
.select('*, messages(*, channels!inner(*))')
404+
.overrideTypes<
405+
{
406+
messages: { channels: { data: string } }[]
407+
}[]
408+
>()
409+
if (result.error) {
410+
throw new Error(result.error.message)
411+
}
412+
let data: typeof result.data
413+
expectType<
414+
TypeEqual<
415+
typeof data,
416+
{
417+
age_range: unknown
418+
catchphrase: unknown
419+
data: CustomUserDataType | null
420+
status: 'ONLINE' | 'OFFLINE' | null
421+
username: string
422+
messages: {
423+
id: number
424+
username: string
425+
channels: {
426+
id: number
427+
data: string
428+
slug: string | null
429+
}
430+
data: Json
431+
channel_id: number
432+
message: string | null
433+
}[]
434+
}[]
435+
>
436+
>(true)
437+
}

0 commit comments

Comments
 (0)