import * as runtimeTypes from 'io-ts' ; import { ReactNode } from 'react' ; export interface DescriptionList { title : NonNullable < ReactNode > ; description : NonNullable < ReactNode > ; } export const unionWithNullType = < T extends runtimeTypes . Mixed > ( type ) => runtimeTypes . union ( [ type , runtimeTypes . null ] ) ; export const stringEnum = < T > ( enumObj , enumName = 'enum' ) => new runtimeTypes . Type < T [ keyof T ] , string > ( enumName , ( u ) : u is T [ keyof T ] => Object . values ( enumObj ) . includes ( u ) , ( u , c ) => Object . values ( enumObj ) . includes ( u ) ? runtimeTypes . success ( u as T [ keyof T ] ) : runtimeTypes . failure ( u , c ) , ( a ) => a as unknown as string ) ; param x param message export const assertUnreachable = ( x , message = 'Unknown Field in switch statement' ) : never => { throw new Error ( `${ message }: ${ x }` ) ; } ;