Skip to content

[Typescript error] match filter only accepts string values #203

@rawatnaresh

Description

@rawatnaresh

Bug report

Describe the bug

Incorrect types for match filter. It should accept any types of values
https://supabase.io/docs/reference/javascript/match

To Reproduce

Add this code to a typescript file and it'll generate error at line 4 saying
Type 'number' is not assignable to type 'string'

const { data, error } = await supabase
  .from('cities')
  .select('name, country_id')
  .match({name: 'Beijing', country_id: 156})

I should change the values to string inorder to get rid of the errors

const { data, error } = await supabase
  .from('cities')
  .select('name, country_id')
  .match({name: 'Beijing', country_id: '156'})  <----------

Expected behavior

It shouldn't throw any type error when passing types other than string

Screenshots

Screen Shot 2021-06-12 at 17 15 10

Also, I'm importing types form '@supabase/postgrest-js'. @supabase/supabase-js doesn't have any exported types.

import { PostgrestFilterBuilder } from '@supabase/postgrest-js';

System information

  • "typescript": "^4.3.2"
  • "@supabase/supabase-js": "^1.14.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions