import { createDefinition } from '../../state/createDefinition' ; import { logWarning } from '../../utils' ; import { Action } from 'redux-actions' ; type State = boolean ; export default createDefinition < State > ( { reducers : { set : ( state , action ) : State => { const val = ( 'payload' in action ) ? action . payload : true ; if ( typeof val !== 'boolean' ) { logWarning ( `Field being set with a non boolean value! Casting type.` ) ; } return ! ! val ; } , toggle : ( state ) : State => ! state , unset : ( state ) : State => false , } , defaultState : false as State , selectors : { get : ( state ) => state , } , } ) ;