how can I get type safety on a `sealed class` `whe...
# announcements
z
how can I get type safety on a
sealed class
when
statement, when used within an rx stream? ex:
Copy code
private val handleDealOperation: (DealOperation) -> State.Change = {
            operation ->
            when (operation) {
                //how to enforce type safety? `DealOperation` is a sealed class
            }
        }
Trying to be typesafe in the context of an rx stream.
Copy code
source.map(handleDealOperation)
p
zak.taccardi: what's the issue? You should be able to add sth like: is DealOp.abc -> Change.A ...
z
yeah, I can manually add it. but I want the compiler to force me with that when
p
I don't get it. What is not typesafe about your solution?