import { IntlState } from '@client/i18n/reducer' ; import { IStoreState } from '@client/store' ; const getPartialState = ( store ) : IntlState => store . i18n ; function getKey < K extends keyof IntlState > ( store , key ) { return getPartialState ( store ) [ key ] ; } export const getLanguage = ( store ) : IntlState [ 'language' ] => getKey ( store , 'language' ) ; export const getLanguages = ( store ) : IntlState [ 'languages' ] => getKey ( store , 'languages' ) ; export const getMessages = ( store ) : IntlState [ 'messages' ] => getKey ( store , 'messages' ) ;