interface NestedBooleanObject { [ key ] : boolean | NestedBooleanObject ; } export const assertDeeplyFalse = ( obj , path = [ ] ) => { Object . keys ( obj ) . forEach ( ( key ) => { const value = obj [ key ] ; if ( typeof value === 'object' && value !== null ) { assertDeeplyFalse ( value , [ ... path , key ] ) ; } else if ( typeof value === 'boolean' ) { if ( value ) { throw new Error ( `${ [ ... path , key ] . join ( '.' ) } is not false: ${ value }` ) ; } } else { throw new Error ( `Expected nest object with boolean keys. '${ key }' is not boolean: ${ value }.` ) ; } } ) ; return true ; } ;