Skip to content

Commit ab5b06d

Browse files
committed
fix: types
1 parent fa63bdf commit ab5b06d

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

src/PostgrestClient.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import { Fetch, GenericSchema, ClientServerOptions, GetGenericDatabaseWithOption
1616
*/
1717
export default class PostgrestClient<
1818
Database = any,
19-
ClientOptions extends ClientServerOptions = GetGenericDatabaseWithOptions<Database>['options'],
19+
ClientOptions extends ClientServerOptions = GetGenericDatabaseWithOptions<
20+
Database,
21+
{ postgrestVersion: 12 }
22+
>['options'],
2023
SchemaName extends string &
2124
keyof GetGenericDatabaseWithOptions<Database>['db'] = 'public' extends keyof GetGenericDatabaseWithOptions<Database>['db']
2225
? 'public'

src/types.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,12 @@ export type GetGenericDatabaseWithOptions<
8989
> = IsAny<Database> extends true
9090
? DatabaseWithOptions<Database, Opts>
9191
: typeof INTERNAL_SUPABASE_OPTIONS extends keyof Database
92-
? DatabaseWithOptions<
93-
Omit<Database, typeof INTERNAL_SUPABASE_OPTIONS>,
94-
Database[typeof INTERNAL_SUPABASE_OPTIONS]
95-
>
92+
? Database[typeof INTERNAL_SUPABASE_OPTIONS] extends ClientServerOptions
93+
? DatabaseWithOptions<
94+
Omit<Database, typeof INTERNAL_SUPABASE_OPTIONS>,
95+
Database[typeof INTERNAL_SUPABASE_OPTIONS]
96+
>
97+
: DatabaseWithOptions<Omit<Database, typeof INTERNAL_SUPABASE_OPTIONS>, Opts>
9698
: DatabaseWithOptions<Database, Opts>
9799

98100
// https://twitter.com/mattpocockuk/status/1622730173446557697

0 commit comments

Comments
 (0)