import { unregisterRootFolder } from '../actions/index' ; import { AppState } from '../RendererTypes' ; param state param action returns export const checkUnregisterRootFolder = ( state , action ) : AppState => { let newFolders = state . folders ; for ( let i = 0 ; i < newFolders . length ; ++ i ) { const folder = newFolders [ i ] ; if ( folder . path === state . currentFolder . path ) { newFolders . splice ( i , 1 ) ; break ; } } return Object . assign ( { } , state , { folders : newFolders , currentFolder : { treeId : 0 , path : '' , isRoot : false } , items : [ ] } ) ; } ;