import BlocState from "../states/BlocState";
import DataState from "../states/DataState";
import ErrorState from "../states/ErrorState";
import InitialState from "../states/InitialState";
import LoadingState from "../states/LoadingState";

export const StateChecker = {
    isInitial(state: BlocState): state is InitialState {
        return state instanceof InitialState
    },
    isLoading(state: BlocState): state is LoadingState {
        return state instanceof LoadingState
    },
    isError<T>(state: BlocState): state is ErrorState<T> {
        return state instanceof ErrorState
    },
    isData<T>(state: BlocState): state is DataState<T> {
        return state instanceof DataState
    }
}