import * as t from 'io-ts' ; internal export function makeEnumIOType < T extends object > ( srcEnum ) { const enumValues = new Set ( Object . values ( srcEnum ) ) ; return new t . Type < T [ keyof T ] , string > ( 'Enum' , ( value ) : value is T [ keyof T ] => Boolean ( value && enumValues . has ( value ) ) , ( value , context ) => ! value || ! enumValues . has ( value ) ? t . failure ( value , context ) : t . success ( ( value as any ) as T [ keyof T ] ) , ( value ) => String ( value ) ) ; }