fumadocs icon indicating copy to clipboard operation
fumadocs copied to clipboard

Content collections has wrong return type for TOC since v1.1.2

Open lauri865 opened this issue 1 year ago • 1 comments

To Reproduce

Check the code for the file @fumadocs/content-collections/dist/configuration.d.ts:

declare function transformMDX<D extends BaseDoc>(document: D, context: Context, options?: TransformOptions): Promise<D & {
    body: string;
    toc: InterfaceToObject<TableOfContents>;
    /**
     * `StructuredData` for search indexes
     */
    structuredData: InterfaceToObject<StructuredData>;
}>;

Current vs. Expected behavior

Current type:

toc: InterfaceToObject<TableOfContents>;

Used to be before:

toc: SerializableTOC

This will cause a type error in content-collections, because InterfaceToObject<TableOfContents> is unserializable

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 23.6.0: Wed Jul 31 20:48:52 PDT 2024; root:xnu-10063.141.1.700.5~1/RELEASE_ARM64_T6020
  Available memory (MB): 32768
  Available CPU cores: 10
Binaries:
  Node: 20.11.0
  npm: 10.2.4
  Yarn: N/A
  pnpm: 9.8.0
Relevant Packages:
  next: 15.0.0-canary.170 // There is a newer canary version (15.0.0-canary.171) available, please upgrade!
  eslint-config-next: 15.0.0-rc.0
  react: 19.0.0-rc-778e1ed2-20240926
  react-dom: 19.0.0-rc-778e1ed2-20240926
  typescript: 5.6.2

Which area(s) are affected? (Select all that apply)

Content Sources (e.g. Fumadocs MDX, Content Collections)

Additional context

No response

lauri865 avatar Sep 26 '24 09:09 lauri865