Friday, 16th February 2024
# List all projects
supabase projects list
# Link a project
supabase link
# Generate types
supabase gen types typescript --project-id "$PROJECT_REF" --schema public > database.types.ts
When you generated your typescript types, you can import the Database type into your components and/or type definitions file. Now you can also type the Supabase client.
import type { Database } from '/database.types'
export type Users = Database["public"]["Tables"]["users"]["Row"];
const supabase = useSupabaseClient<Database>()