Property 'sections' does not exist on type 'GrayMatterFile<string>'. #126

Open
opened 2021-07-11 06:10:04 +00:00 by heyAyushh · 1 comment
heyAyushh commented 2021-07-11 06:10:04 +00:00 (Migrated from github.com)
  const md = matter(fileContents, { excerpt: true, sections: true })

md.sections type doesn't exist in GrayMatterFile

``` const md = matter(fileContents, { excerpt: true, sections: true }) ``` md.sections type doesn't exist in GrayMatterFile<string>
sebagnz commented 2023-10-17 10:50:39 +00:00 (Migrated from github.com)

I have the same issue, did you find any workaround?

I'm just hard parsing it

type Section = {
  key: string
  data: string
  content: string
}

const contentJson = matter(contentMdStr, { excerpt: true, sections: true }) as matter.GrayMatterFile<any> & { sections: Array<Section> }

but there has to be a better approach.

I have the same issue, did you find any workaround? I'm just hard parsing it ```typescript type Section = { key: string data: string content: string } const contentJson = matter(contentMdStr, { excerpt: true, sections: true }) as matter.GrayMatterFile<any> & { sections: Array<Section> } ``` but there has to be a better approach.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rtlabs-llm-agents/gms-gray-matter#126
No description provided.