From fd07eb27c59e5e36ec6b1e1e35070a07566333ab Mon Sep 17 00:00:00 2001 From: amirhouieh Date: Sat, 26 Aug 2023 14:27:44 +0200 Subject: [PATCH] fix type errors --- src/containers/StaticPage/StaticPage.tsx | 15 +++++++-------- src/types/lpe.types.ts | 1 - 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/containers/StaticPage/StaticPage.tsx b/src/containers/StaticPage/StaticPage.tsx index 8452a93..cffb386 100644 --- a/src/containers/StaticPage/StaticPage.tsx +++ b/src/containers/StaticPage/StaticPage.tsx @@ -19,20 +19,19 @@ export const StaticPage: React.FC = ({ ...props }) => { const titleBlock = data.page.content.find((block) => { - // TODO @Hossein - type definition for classNames is missing for both block types - // @ts-ignore - return block.classNames && block.classNames.includes('title') - }) + return ( + block.type === LPE.Post.ContentBlockTypes.Text && + block.classNames && + block.classNames.includes('title') + ) + }) as LPE.Post.TextBlock | undefined return (
{titleBlock && ( - { - // @ts-ignore - titleBlock.text - } + {titleBlock.text} )} {data.page.content.map((block, idx) => ( diff --git a/src/types/lpe.types.ts b/src/types/lpe.types.ts index aecd6bc..3b34fa1 100644 --- a/src/types/lpe.types.ts +++ b/src/types/lpe.types.ts @@ -52,7 +52,6 @@ export namespace LPE { } as const export type ContentBlockType = DictValues - export const ContentBlockLabels = { Title: 'title', Subtitle: 'subtitle',