Type Error

Can anyone thats worked with Supabase, Next.js, and Typescript help me understand this error? ParserError<"Unexpected input: " | "Unexpected input: ,name,photo_url,hardware,profile_id">[] | null

this is the code im working with:
interface Props {
  table: 'likes' | 'downloads' | 'presets'; 
  hardware?: Enums<'hardware_type'>;
  limit?: number;
  user_id?: string;
}

  const { hardware, limit, table, user_id } = props

  const generateSelectClause = () => {
    const likesAndDownloadSelectClause = `presets(preset_id,name,photo_url,hardware,profile_id)`

    const presetsSelectClause = `preset_id,name,photo_url,hardware,profile_id`

    const allSelectClause = `*`

    switch (table) {
      case ('downloads'):
        return likesAndDownloadSelectClause
      case ('likes'):
        return likesAndDownloadSelectClause
      case ('presets'):
        return presetsSelectClause
      default:
        return allSelectClause
    }
  }

  let query = supabase
    .from(table)
    .select(generateSelectClause())
  
  if (hardware) query = query.eq("presets.hardware", hardware)
  if (user_id) query = query.eq("presets.profile_id", user_id)
  if (limit) query = query.limit(limit)

  const { data, error } = await query

  if (error || !data) {
    return <div>there was an error</div>
  }

  const presetsList = data.map(({ presets: preset }) => <PresetTile
    key={preset?.preset_id}
    preset={preset as Pick<Tables<'presets'>, 'hardware' | 'name' | 'photo_url' | 'preset_id' | 'profile_id'>}
  />)
image.png
Was this page helpful?