Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken types #224

Closed
leeuwd opened this issue Jun 24, 2023 · 3 comments · Fixed by #225
Closed

Broken types #224

leeuwd opened this issue Jun 24, 2023 · 3 comments · Fixed by #225
Labels
bug Something isn't working

Comments

@leeuwd
Copy link

leeuwd commented Jun 24, 2023

Describe the bug

image
Type error: No overload matches this call.
  Overload 1 of 3, '(extraArgument?: null | undefined, options?: SWRMutationConfiguration<any, PostgrestError, { about?: string | null | undefined; avatar?: string | null | undefined; created_at?: string | undefined; ... 6 more ...; year_of_birth?: number | ... 1 more ... | undefined; }, never, { ...; }> | undefined): Promise<...>', gave the following error.
    Argument of type '{ id: string; newsletter: boolean; updated_at: string; }' is not assignable to parameter of type 'null | undefined'.
  Overload 2 of 3, '(extraArgument?: null | undefined, options?: (SWRMutationConfiguration<any, PostgrestError, { about?: string | null | undefined; avatar?: string | null | undefined; created_at?: string | undefined; ... 6 more ...; year_of_birth?: number | ... 1 more ... | undefined; }, never, { ...; }> & { ...; }) | undefined): Promise<...>', gave the following error.
    Argument of type '{ id: string; newsletter: boolean; updated_at: string; }' is not assignable to parameter of type 'null | undefined'.
  Overload 3 of 3, '(extraArgument?: null | undefined, options?: (SWRMutationConfiguration<any, PostgrestError, { about?: string | null | undefined; avatar?: string | null | undefined; created_at?: string | undefined; ... 6 more ...; year_of_birth?: number | ... 1 more ... | undefined; }, never, { ...; }> & { ...; }) | undefined): Promise<...>', gave the following error.
    Argument of type '{ id: string; newsletter: boolean; updated_at: string; }' is not assignable to parameter of type 'null | undefined'.

Mutations their types are incorrect since latest TypeScript (issue detected with TypeScript 5.1.3) and:

├─ @supabase-cache-helpers/postgrest-fetcher@1.0.12
├─ @supabase-cache-helpers/postgrest-filter@1.0.9
├─ @supabase-cache-helpers/postgrest-mutate@1.0.13
├─ @supabase-cache-helpers/postgrest-shared@1.0.5
├─ @supabase-cache-helpers/postgrest-swr@1.0.17

Additional context

Will try to create Codepen on this.

@leeuwd leeuwd added the bug Something isn't working label Jun 24, 2023
@psteinroe
Copy link
Owner

Thanks for opening the issue! What supabase-js version are you using?

@leeuwd
Copy link
Author

leeuwd commented Jun 28, 2023

├─ @supabase-cache-helpers/postgrest-fetcher@1.0.12
├─ @supabase-cache-helpers/postgrest-filter@1.0.9
├─ @supabase-cache-helpers/postgrest-mutate@1.0.13
├─ @supabase-cache-helpers/postgrest-shared@1.0.5
├─ @supabase-cache-helpers/postgrest-swr@1.0.17
├─ @supabase/auth-helpers-nextjs@0.7.2
├─ @supabase/auth-helpers-react@0.4.0
├─ @supabase/auth-helpers-shared@0.4.1
├─ @supabase/functions-js@2.1.2
├─ @supabase/gotrue-js@2.31.0
├─ @supabase/postgrest-js@1.7.1
├─ @supabase/realtime-js@2.7.3
├─ @supabase/storage-js@2.5.1
├─ @supabase/supabase-js@2.26.0

@psteinroe
Copy link
Owner

the issue is the postgrest-js version. supabase changed the internal types to support relations, and I need to adapt the cache helpers to that. the pr for the version update is failing (#191). will try to squeeze it in this or latest next week and publish a new version. for the meantime, use an older postgrest-js version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants