export type DeepPartial < T > = { [ P in keyof T ] ? : DeepPartial < T [ P ] > ; } ; export function matcher < T > ( reference ) { return ( value ) => { if ( typeof ( value ) === 'object' && typeof ( reference ) === 'object' ) { let castedValue = value as Record < string , any > ; let castedReference = reference as Record < string , any > ; return Object . entries ( castedReference ) . every ( ( [ key , ref ] ) => matcher ( ref ) ( castedValue [ key ] ) ) ; } else { return value === reference ; } } ; }