Skip to content

Commit 1df70ad

Browse files
authored
fix: fix createBrowserClient deprecation tsdoc (#17)
Fixes the deprecation TSDoc on `createBrowserClient` to not show up if you don't pass in any options. Discussion: https://github.com/orgs/supabase/discussions/27037#discussioncomment-9764831
1 parent 0b5f881 commit 1df70ad

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Diff for: src/createBrowserClient.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,21 @@ import { createStorageFromOptions } from "./cookies";
2929
let cachedBrowserClient: SupabaseClient<any, any, any> | undefined;
3030

3131
/**
32-
* @deprecated Please specify `getAll` and `setAll` cookie methods instead of
33-
* the `get`, `set` and `remove`. These will not be supported in the next major
34-
* version.
32+
* Creates a Supabase Client for use in a browser environment.
33+
*
34+
* In most cases you should not configure the `options.cookies` object, as this
35+
* is automatically handled for you. If you do customize this, prefer using the
36+
* `getAll` and `setAll` functions over `get`, `set` and `remove`. The latter
37+
* are deprecated due to being difficult to correctly implement and not
38+
* supporting some edge-cases. Both `getAll` and `setAll` (or both `get`, `set`
39+
* and `remove`) must be provided. Failing to provide the methods for setting
40+
* will throw an exception, and in previous versions of the library will result
41+
* in difficult to debug authentication issues such as random logouts, early
42+
* session termination or problems with inconsistent state.
43+
*
44+
* @param supabaseUrl The URL of the Supabase project.
45+
* @param supabaseKey The `anon` API key of the Supabase project.
46+
* @param options Various configuration options.
3547
*/
3648
export function createBrowserClient<
3749
Database = any,
@@ -45,29 +57,17 @@ export function createBrowserClient<
4557
supabaseUrl: string,
4658
supabaseKey: string,
4759
options?: SupabaseClientOptions<SchemaName> & {
48-
cookies: CookieMethodsBrowserDeprecated;
60+
cookies?: CookieMethodsBrowser;
4961
cookieOptions?: CookieOptionsWithName;
5062
cookieEncoding?: "raw" | "base64url";
5163
isSingleton?: boolean;
5264
},
5365
): SupabaseClient<Database, SchemaName, Schema>;
5466

5567
/**
56-
* Creates a Supabase Client for use in a browser environment.
57-
*
58-
* In most cases you should not configure the `options.cookies` object, as this
59-
* is automatically handled for you. If you do customize this, prefer using the
60-
* `getAll` and `setAll` functions over `get`, `set` and `remove`. The latter
61-
* are deprecated due to being difficult to correctly implement and not
62-
* supporting some edge-cases. Both `getAll` and `setAll` (or both `get`, `set`
63-
* and `remove`) must be provided. Failing to provide the methods for setting
64-
* will throw an exception, and in previous versions of the library will result
65-
* in difficult to debug authentication issues such as random logouts, early
66-
* session termination or problems with inconsistent state.
67-
*
68-
* @param supabaseUrl The URL of the Supabase project.
69-
* @param supabaseKey The `anon` API key of the Supabase project.
70-
* @param options Various configuration options.
68+
* @deprecated Please specify `getAll` and `setAll` cookie methods instead of
69+
* the `get`, `set` and `remove`. These will not be supported in the next major
70+
* version.
7171
*/
7272
export function createBrowserClient<
7373
Database = any,
@@ -81,7 +81,7 @@ export function createBrowserClient<
8181
supabaseUrl: string,
8282
supabaseKey: string,
8383
options?: SupabaseClientOptions<SchemaName> & {
84-
cookies?: CookieMethodsBrowser;
84+
cookies: CookieMethodsBrowserDeprecated;
8585
cookieOptions?: CookieOptionsWithName;
8686
cookieEncoding?: "raw" | "base64url";
8787
isSingleton?: boolean;

0 commit comments

Comments
 (0)