есть компонент
import { useEffect, useState } from "react"
import { useParams } from "react-router-dom"
import FullNewsComponent from "@/components/ui/fullNewsPage/FullNewsComponent"
import dfn from '../demoData/demoFullNews.json'
import { IFullNewsInterface } from "@/components/interfaces/FullNews.interface"
const FullNewsPage = () => {
const [fullNewsData, setFullNewsData] = useState<IFullNewsInterface>()
const {seo} = useParams()
useEffect(() => {
const newsdata = dfn.newsData.filter(data => data.seo === seo)
setFullNewsData(newsdata[0] as IFullNewsInterface)
}, [])
console.log(fullNewsData);
return (
<>
<FullNewsComponent {...fullNewsData} />
</>
)
}
export default FullNewsPage
выдается ошибка:
Тип "{ articleId?: number | undefined; category?: string | undefined; title?: string | undefined; seo?: string | undefined; authorData?: IUserShortData | undefined; fullText?: string | undefined; views?: number | undefined; comments?: number | undefined; publishedDate?: number | undefined; tags?: ITagsInterface[] | undef..." не может быть назначен для типа "IFullNewsInterface".
Типы свойства "articleId" несовместимы.
Тип "number | undefined" не может быть назначен для типа "number".
Тип "undefined" не может быть назначен для типа "number".ts(2322)
(alias) const FullNewsComponent: (props: IFullNewsInterface) => JSX.Element
import FullNewsComponent
Reused component for rendering full article, news or blog page
в консоле при выводе в лог console.log(fullNewsData) undefined