File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -92,20 +92,20 @@ export default class SupabaseClient<
9292
9393 const settings = applySettingDefaults ( options ?? { } , DEFAULTS )
9494
95- this . storageKey = settings . auth ? .storageKey ?? ''
96- this . headers = settings . global ? .headers ?? { }
95+ this . storageKey = settings . auth . storageKey ?? ''
96+ this . headers = settings . global . headers ?? { }
9797
9898 this . auth = this . _initSupabaseAuthClient (
9999 settings . auth ?? { } ,
100100 this . headers ,
101- settings . global ? .fetch
101+ settings . global . fetch
102102 )
103- this . fetch = fetchWithAuth ( supabaseKey , this . _getAccessToken . bind ( this ) , settings . global ? .fetch )
103+ this . fetch = fetchWithAuth ( supabaseKey , this . _getAccessToken . bind ( this ) , settings . global . fetch )
104104
105105 this . realtime = this . _initRealtimeClient ( { headers : this . headers , ...settings . realtime } )
106106 this . rest = new PostgrestClient ( `${ _supabaseUrl } /rest/v1` , {
107107 headers : this . headers ,
108- schema : settings . db ? .schema ,
108+ schema : settings . db . schema ,
109109 fetch : this . fetch ,
110110 } )
111111
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export function applySettingDefaults<
2323> (
2424 options : SupabaseClientOptions < SchemaName > ,
2525 defaults : SupabaseClientOptions < any >
26- ) : SupabaseClientOptions < SchemaName > {
26+ ) : Required < SupabaseClientOptions < SchemaName > > {
2727 const {
2828 db : dbOptions ,
2929 auth : authOptions ,
Original file line number Diff line number Diff line change @@ -33,10 +33,10 @@ test('override setting defaults', async () => {
3333 } ,
3434 }
3535 let settings = helpers . applySettingDefaults ( options , defaults )
36- expect ( settings ? .auth ? .autoRefreshToken ) . toBe ( autoRefreshOption )
36+ expect ( settings . auth . autoRefreshToken ) . toBe ( autoRefreshOption )
3737 // Existing default properties should not be overwritten
38- expect ( settings ? .auth ? .persistSession ) . not . toBeNull ( )
39- expect ( settings ? .global ? .headers ) . toBe ( DEFAULT_HEADERS )
38+ expect ( settings . auth . persistSession ) . not . toBeNull ( )
39+ expect ( settings . global . headers ) . toBe ( DEFAULT_HEADERS )
4040 // Existing property values should remain constant
41- expect ( settings ? .db ? .schema ) . toBe ( defaults . db . schema )
41+ expect ( settings . db . schema ) . toBe ( defaults . db . schema )
4242} )
You can’t perform that action at this time.
0 commit comments