content icon indicating copy to clipboard operation
content copied to clipboard

Export ParsedContent types

Open cco3 opened this issue 2 years ago • 5 comments

Is your feature request related to a problem? Please describe

Right now, the types in @nuxt/content/dist/runtime/types are not available in the package.json exports. This makes the eslint resolver choke when following the approach described in the docs.

import type { MarkdownParsedContent } from '@nuxt/content/dist/runtime/types'
[eslint]   1:1  error    Resolve error: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './' is not defined by "exports" in /home/user/project/node_modules/@nuxt/content/package.json
[eslint]     at new NodeError (node:internal/errors:405:5)
[eslint]     at exportsNotFound (node:internal/modules/esm/resolve:359:10)
[eslint]     at packageExportsResolve (node:internal/modules/esm/resolve:695:9)
[eslint]     at resolveExports (node:internal/modules/cjs/loader:567:36)
[eslint]     at Module._findPath (node:internal/modules/cjs/loader:636:31)
[eslint]     at findModulePath (/home/user/project/node_modules/eslint-import-resolver-alias/index.js:99:27)
[eslint]     at exports.resolve (/home/user/project/node_modules/eslint-import-resolver-alias/index.js:75:10)
[eslint]     at withResolver (/home/user/project/node_modules/eslint-module-utils/resolve.js:114:23)
[eslint]     at fullResolve (/home/user/project/node_modules/eslint-module-utils/resolve.js:135:22)
[eslint]     at relative 

Describe the solution you'd like

Add these types to the rest of the exported types (found at @nuxt/content/dist/types.d.ts)

cco3 avatar Sep 28 '23 03:09 cco3

Second this. Really annoying since I extend the MarkdownParsedContent to many interface I'm using.

xarthurx avatar Jun 28 '24 21:06 xarthurx

Same issue

wokalek avatar Jun 29 '24 18:06 wokalek

This appears to be fixed. I can now do import type { MarkdownParsedContent } from "@nuxt/content";

cco3 avatar Jul 03 '24 15:07 cco3

Just need to update docs then

wokalek avatar Jul 03 '24 16:07 wokalek

Alright, reopening for docs

cco3 avatar Jul 03 '24 16:07 cco3