Replicate `is` operator in an `inline infix reified` function

I have an couple of inline infix functions with reified types inside of a builder, that check whether an input object is of the correct class inside of a builder block. This function is used many times to abstract a simple pattern:

    inline infix fun <T: Any, reified R: Any> T.thenRequire(
            event: R): T {
        return when (this) {
            is R -> this
            else -> throw InvalidEventException(state, this)
        }
    }

    inline infix fun <T: Any, reified R: Any> T.thenRequire(
            event: KClass<R>): T {
        return when (this) {
            is R -> this
            else -> throw InvalidEventException(state, this)
        }
    }

within the builder block I can then use this as part of a DSL to build a stateFlow:

val stateFlow = stateFlow<Mode, Event> {
    uninitialized@ while (true) {
        yield(Mode.Uninitialized) thenRequire Command.Initialize
        yield(Mode.Initializing) thenRequire Response.Initialized
        when (yield(Mode.Initialized)) {
            is Command.Prepare -> {
                when (val next = yield(Mode.Preparing)) {
                    is Response.Prepared    -> {
                    }
                    is Command.Uninitialize -> {
                        yield(Mode.Uninitializing) thenRequire Response.Uninitialized
                        continue@uninitialized
                    }
                }
            }
        }
    }
}

The first form of the inline infix fun thenRequire(event: R) works well for objects, but I would like to pass data classes to without having to explicitly write Response.DataAttained::class when using the second form of the inline infix fun thenRequire(KClass<R>) as then ::class would litter the DSL.

I have chosen to model my Events as sealed objects only, but I would like to start having events carry data.

Is there a way to mimic the is operator? so I could write:

sealed class Response {
     data class DataAttained(val data: Data): Response() 
}

// in the builder

val response = yield(Mode.AwaitingData) thenRequire Response.DataAttained
println(response.data)

rather than:

val response = yield(Mode.AwaitingData) thenRequire Response.DataAttained::class

Thanks for your attention!

If this is not possible with current kotlin syntax, could a syntax modification be something like:

    inline infix fun <T: Any, reified R: Any> T.thenRequire(
            event: is KClass<R>): T {
        return when (this) {
            is R -> this
            else -> throw InvalidEventException(state, this)
        }
    }

Note the additional is that prepends the KClass<R>