import { ReactNode } from 'react' import styles from './InfoBar.module.css' interface ArbitraryChildrenProps { children: ReactNode } interface SideNoteProps { text: string } interface PostInfoPros { publishedDate: Date, authorName: string } interface SystemMemberInfoProps { memberName: string, memberAvatar: string } type InfobarProps = ( ArbitraryChildrenProps | SideNoteProps | PostInfoPros | SystemMemberInfoProps ) export default function InfoBar(props: InfobarProps) { if ('text' in props) { return ( ) } if ('authorName' in props) { return ( ) } if ('memberName' in props) { return ( ) } if ('children' in props) { return ( ) } throw new Error('Unknown infobar type') }