import { RequestStateEnum } from '@core/domain/request/RequestStateEnum' ; class State { name : RequestStateEnum ; protected setState ( to , predicate ) { this . checkState ( predicate ) ; this . name = to ; } protected checkState ( predicate ) { if ( ! predicate ( this . name ) ) { throw new Error ( 'Illegal state machine transition' ) ; } } } export default State ;