Búsqueda de sitios web

typescript - El tipo de contenido de Nuxt 'ParsedContent | null' no es asignable al tipo 'Record | undefined'


Estoy probando @nuxt/content pero no logro obtener una demostración funcionando con un ejemplo simple.

 ERROR(vue-tsc)  Type 'ParsedContent | null' is not assignable to type 'Record<string, any> | undefined'.

/contenido/noticias/prueba.md

---
title: 'test'
tag: ['test']
---

test1

content

/páginas/mi-página.vue

<script setup lang="ts">
import type { ParsedContent } from '@nuxt/content/dist/runtime/types'

interface MyCustomParsedContent extends ParsedContent {
  tag: Array<string>
}

const { data:article } = await useAsyncData(() => queryContent<MyCustomParsedContent>('news')
  .where({ tag: { $in: ['patch-note'] } })
  .sort({ date: -1 })
  .findOne())


if (!article.value) {
  throw createError({
    statusCode: 404,
    statusMessage: "Page not found",
  });
}
</script>

<template>
  <div>
        <ContentRenderer :value="article" />
  </div>
</template>

Respuesta #1

Arreglado con <ContentRenderer :value="article as any" />

No estoy seguro de que sea la solución más limpia, pero está funcionando