Importing createClient into edge function throws TS error and cannot start
I posted images of the code and errors. I removed all the code in my actual function to show it's the import statement failing.
Function code:
// Follow this setup guide to integrate the Deno language server with your editor:// https://deno.land/manual/getting_started/setup_your_environment// This enables autocomplete, go to definition, etc.import { serve } from 'https://deno.land/std@0.131.0/http/server.ts';import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.0.0';
// Follow this setup guide to integrate the Deno language server with your editor:// https://deno.land/manual/getting_started/setup_your_environment// This enables autocomplete, go to definition, etc.import { serve } from 'https://deno.land/std@0.131.0/http/server.ts';import { createClient } from 'https://esm.sh/@supabase/supabase-js@2.0.0';
Error:
Download https://deno.land/std@0.165.0/node/internal_binding/_winerror.tsCheck file:///home/deno/functions/test/index.tserror: TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:57:126TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<View>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:58:120TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). from(relation: string): PostgrestQueryBuilder<any>; ~~~~~~~~~~~~~~~~~~~~~~~~~~ at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:59:29TS2314 [ERROR]: Generic type 'PostgrestFilterBuilder<Schema, Row, Result>' requires 3 type argument(s). at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:72:9Found 4 errors.2022/11/21 11:28:48 Sent Header: Host [docker]2022/11/21 11:28:48 Sent Header: User-Agent [Go-http-client/1.1]2022/11/21 11:28:48 Send Done2022/11/21 11:28:48 Recv First ByteError: error executing command
Download https://deno.land/std@0.165.0/node/internal_binding/_winerror.tsCheck file:///home/deno/functions/test/index.tserror: TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:57:126TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). from<ViewName extends string & keyof Schema['Views'], View extends Schema['Views'][ViewName]>(relation: ViewName): PostgrestQueryBuilder<View>; ~~~~~~~~~~~~~~~~~~~~~~~~~~~ at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:58:120TS2314 [ERROR]: Generic type 'PostgrestQueryBuilder<Schema, Relation>' requires 2 type argument(s). from(relation: string): PostgrestQueryBuilder<any>; ~~~~~~~~~~~~~~~~~~~~~~~~~~ at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:59:29TS2314 [ERROR]: Generic type 'PostgrestFilterBuilder<Schema, Row, Result>' requires 3 type argument(s). at https://esm.sh/v99/@supabase/supabase-js@2.0.0/dist/module/SupabaseClient.d.ts:72:9Found 4 errors.2022/11/21 11:28:48 Sent Header: Host [docker]2022/11/21 11:28:48 Sent Header: User-Agent [Go-http-client/1.1]2022/11/21 11:28:48 Send Done2022/11/21 11:28:48 Recv First ByteError: error executing command
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.