I'm using Intellij as the IDE for my Flutter project.
Part of this project includes a 'Supabase' edge function that has one TS file. The TS file is showing two parsing problems with the TS file
TS2304: Cannot find name 'Deno'.
How can I supress these warnings?
// 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.
// @ts-ignore
import { serve } from 'https://deno.land/[email protected]/http/server.ts';
// @ts-ignore
import { createClient } from "https://esm.sh/@supabase/[email protected]";
console.log("Delete user account function up and running");
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
}
serve(async (req) => {
// This is needed if you're planning to invoke your function from a browser.
if (req.method === 'OPTIONS') {
return new Response('ok', { headers: corsHeaders })
}
try {
//Create instance of SupabaseClient
// @ts-ignore
const supabaseClient = createClient(
Deno.env.get("SUPABASE_URL") ?? "",
Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ?? "",
);
// Get the authorization header from the request.
// When you invoke the function via the client library
// it will automatically pass the authenticated user's JWT.
const authHeader = req.headers.get("Authorization");
// Get JWT from auth header
const jwt = authHeader.replace("Bearer ", "");
// Get the user object
const {
data: { user },
} = await supabaseClient.auth.getUser(jwt);
if (!user) throw new Error("No user found for JWT!");
//Call deleteUser method and pass user's ID
const { data, error } = await supabaseClient.auth.admin.deleteUser(user.id);
return new Response(JSON.stringify(data), {
headers: {...corsHeaders, "Content-Type": "application/json" },
status: 200,
});
} catch (error) {
return new Response(JSON.stringify(error), {
headers: { ...corsHeaders, "Content-Type": "application/json" },
status: 400,
});
}
});