import { FC } from 'react' import { PageBodyItem } from '../../services/Wagtail/PagesAPI/types' export interface StreamFieldProps { body: PageBodyItem[] availableBlocks: StreamFieldsTableType } export type StreamFieldsTableType = { // TODO (Tech Debt): Switch "key: string" to a list of valid types that can be added within the availableBlocks. [key: string]: ExtractFC } // helper type to transform PageBodyItem into FC | FC | ... export type ExtractFC = T extends { type: string } ? FC : never