Open cmcnicholas opened 10 months ago
I had to use patch-package
to patch this types file to satisfy TypeScript like this (don't copy this patch though, better create your own):
diff --git a/node_modules/@nuxt/content/dist/runtime/components/ContentRendererMarkdown.vue b/node_modules/@nuxt/content/dist/runtime/components/ContentRendererMarkdown.vue
index 9c4329c..6cc40c1 100644
--- a/node_modules/@nuxt/content/dist/runtime/components/ContentRendererMarkdown.vue
+++ b/node_modules/@nuxt/content/dist/runtime/components/ContentRendererMarkdown.vue
@@ -4,7 +4,7 @@
:data="data"
:tag="tag"
:components="mdcComponents"
- :data-content-id="debug ? value._id : undefined"
+ :data-content-id="debug ? value['_id'] : undefined"
/>
</template>
@@ -51,9 +51,9 @@ const props = defineProps({
const debug = process.dev || useContentPreview().isEnabled()
const body = computed(() => {
- let body = props.value.body || props.value
- if (props.excerpt && props.value.excerpt) {
- body = props.value.excerpt
+ let body = props.value['body'] || props.value
+ if (props.excerpt && props.value['excerpt']) {
+ body = props.value['excerpt']
}
return body
@@ -71,7 +71,7 @@ const data = computed(() => {
const mdcComponents = computed(() => {
return {
...props.components,
- ...(data.value._components || {})
+ ...(data.value['_components'] || {})
}
})
</script>
Environment
Build Modules: -
Reproduction
https://stackblitz.com/edit/github-ev1cct?file=nuxt.config.ts
try
npm run build
- output will match logs belowDescribe the bug
When using tsconfig features such as
noPropertyAccessFromIndexSignature
and running a production build of nuxt with the content module. The build fails with warnings about content componentContentRendererMarkdown.vue
.The tsconfig generated by nuxt should not evaluate modules that are adding the solution, there doesn't look like a nice way to make use of these additional typescript typechecking features.
Additional context
No response
Logs