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

value type for .contains() is not specific enough #435

Open
laeo opened this issue Jun 9, 2023 · 1 comment
Open

value type for .contains() is not specific enough #435

laeo opened this issue Jun 9, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@laeo
Copy link

laeo commented Jun 9, 2023

I have a uuid[] field, and i have to filter data using contains method.

VSCode shows the .contains() accept a string | Record<string, unknown> | unknown[] as second param, but it will errors when i pass a string value,

{
  code: "22P02",
  details: 'Array value must start with "{" or dimension information.',
  hint: null,
  message: 'malformed array literal: "06591b00-2d5f-4af1-8203-2324323c5ff2"'
}

If i pass an string[], everything looks good.

Maybe the generated type schema wrong? Or the JS lib not correctly handle them.

  • Runtime: Edge Functions
  • supabase-js: 2.22.0
  • Supabase CLI: 1.64.3
@laeo laeo added the bug Something isn't working label Jun 9, 2023
@steve-chavez steve-chavez transferred this issue from supabase/supabase-js Jun 10, 2023
@soedirgo soedirgo changed the title .contains won't accept string value value type for .contains() is not specific enough Jun 13, 2023
@soedirgo
Copy link
Member

Thanks! We could definitely be more specific here - string is valid for range types, Record<string, unknown> is for json/jsonb, and unknown[] is for array types.

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

No branches or pull requests

2 participants