port js files in lib and lib/containers to ts (#3957)

* rename files in lib and lib/containers to ts

* add types

* fix ts errors
This commit is contained in:
Labhansh Agrawal 2019-11-11 20:51:42 +05:30 committed by Benjamin Staneck
parent d5d5bcc74c
commit a1eb84d8a7
17 changed files with 163 additions and 59 deletions

13
lib/selectors.ts Normal file
View file

@ -0,0 +1,13 @@
import {createSelector} from 'reselect';
import {HyperState} from './hyper';
const getTermGroups = ({termGroups}: Pick<HyperState, 'termGroups'>) => termGroups.termGroups;
const getRootGroups = createSelector(
getTermGroups,
termGroups =>
Object.keys(termGroups)
.map(uid => termGroups[uid])
.filter(({parentUid}) => !parentUid)
);
export default getRootGroups;