supabase / postgrest-js

Isomorphic JavaScript client for PostgREST.
https://supabase.com
MIT License
1.04k stars 133 forks source link

Function interface type #377

Open digoburigo opened 1 year ago

digoburigo commented 1 year ago

Bug report

export type Json =
  | string
  | number
  | boolean
  | null
  | { [key: string]: Json }
  | Json[];

export interface Database {
  cadastro: {
    Tables: {
      [_ in never]: never;
    };
    Views: {
      [_ in never]: never;
    };
    Functions: {
      aval_imoveis: {
        Args: { inscricao_imobiliaria: string };
        Returns: Example;
      };
    };
    Enums: {
      [_ in never]: never;
    };
  };
}

interface Example {
  prop: string;
}

Describe the bug

Why putting an interface on the Returns property I get an array type when using the postgrest client?

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Just add a custom Interface on the ´Returns` property and use the client with the specific function

Expected behavior

I don't know if it's a bug or I'm using the interface of the supabase client wrong

Screenshots

image

System information