withStateOrThrow

inline suspend fun <T : S, S : MVIState> PipelineContext<S, *, *>.withStateOrThrow(crossinline block: suspend T.() -> Unit)

Use the state if it is of type T, otherwise, throw InvalidStateException.

Same rules apply as StateReceiver.withState