Fix ANY types in FAQFull filter
This commit is contained in:
@@ -54,12 +54,12 @@ export default async function Page(props: {
|
|||||||
let faqSchema: Record<string, any> | null = null;
|
let faqSchema: Record<string, any> | null = null;
|
||||||
const faqBlock = layout.find((b: any) => b.blockType === 'faqFull') as FAQFullBlock | undefined;
|
const faqBlock = layout.find((b: any) => b.blockType === 'faqFull') as FAQFullBlock | undefined;
|
||||||
if (faqBlock && faqBlock.questions) {
|
if (faqBlock && faqBlock.questions) {
|
||||||
const validQuestions = faqBlock.questions.filter((q: any) => !q.isDraft);
|
const validQuestions = faqBlock.questions.filter((q: NonNullable<FAQFullBlock['questions']>[0]) => !q.isDraft);
|
||||||
if (validQuestions.length > 0) {
|
if (validQuestions.length > 0) {
|
||||||
faqSchema = {
|
faqSchema = {
|
||||||
"@context": "https://schema.org",
|
"@context": "https://schema.org",
|
||||||
"@type": "FAQPage",
|
"@type": "FAQPage",
|
||||||
"mainEntity": validQuestions.map((q: any) => ({
|
"mainEntity": validQuestions.map((q: NonNullable<FAQFullBlock['questions']>[0]) => ({
|
||||||
"@type": "Question",
|
"@type": "Question",
|
||||||
"name": q.question,
|
"name": q.question,
|
||||||
"acceptedAnswer": {
|
"acceptedAnswer": {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const FAQFullBlockComponent: React.FC<Props> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Filter out placeholder questions
|
// Filter out placeholder questions
|
||||||
const validQuestions = (questions || []).filter((q: any) => !q.isDraft);
|
const validQuestions = (questions || []).filter((q: NonNullable<Props['questions']>[0]) => !q.isDraft);
|
||||||
|
|
||||||
// Group by category
|
// Group by category
|
||||||
const groupedQuestions = validQuestions.reduce((acc, q) => {
|
const groupedQuestions = validQuestions.reduce((acc, q) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user