#Property 'map' does not exist on type 'CollectionEntry'

3 messages · Page 1 of 1 (latest)

reef tide
#

I'm following guide at https://docs.astro.build/en/guides/content-collections/ and get a warning on map() function

Property 'map' does not exist on type 'CollectionEntry<"properties">'.
  Property 'map' does not exist on type '{ id: "REDACTED.mdx"; slug: "REDACTED"; body: string; collection: "properties"; data: { gallery?: { title: string; dir: string; }[] | undefined; title: string; slug: string; city: string; category: "residential" | "commercial"; ... 5 more ...; sold: boolean; }; } & Render'.ts(2339)
---
import type { CollectionEntry } from "astro:content";

interface Props {
  properties: CollectionEntry<"properties">;
}

const { properties } = Astro.props;
---
  {
    properties.map((property) => (
//stuff
  ))
  }
unkempt mirage
#

Try properties: CollectionEntry<"properties">[].

#

The docs only show an example where it's being passed a single entry, not the whole collection 🙂