@@ -21,23 +21,25 @@ export * from '@supabase/realtime-js'
2121export { default as SupabaseClient } from './SupabaseClient'
2222export type { SupabaseClientOptions , QueryResult , QueryData , QueryError } from './lib/types'
2323
24- /**
25- * Creates a new Supabase Client.
26- */
27- export const createClient = <
24+ export type CreateClientHelper < AdditionalOptions = { } > = <
2825 Database = any ,
2926 SchemaName extends string & keyof Database = 'public' extends keyof Database
3027 ? 'public'
3128 : string & keyof Database ,
32- Schema extends GenericSchema = Database [ SchemaName ] extends GenericSchema
33- ? Database [ SchemaName ]
34- : any
29+ Schema = Database [ SchemaName ] extends GenericSchema ? Database [ SchemaName ] : any
3530> (
3631 supabaseUrl : string ,
3732 supabaseKey : string ,
38- options ?: SupabaseClientOptions < SchemaName >
39- ) : SupabaseClient < Database , SchemaName , Schema > => {
40- return new SupabaseClient < Database , SchemaName , Schema > ( supabaseUrl , supabaseKey , options )
33+ options ?: SupabaseClientOptions < SchemaName > & AdditionalOptions
34+ ) => SupabaseClient < Database , SchemaName , Schema extends GenericSchema ? Schema : any >
35+
36+ export type GenericSupabaseClient = SupabaseClient < any , any , any >
37+
38+ /**
39+ * Creates a new Supabase Client.
40+ */
41+ export const createClient : CreateClientHelper = ( supabaseUrl , supabaseKey , options ) => {
42+ return new SupabaseClient ( supabaseUrl , supabaseKey , options )
4143}
4244
4345// Check for Node.js <= 18 deprecation
0 commit comments