Nikolai Sviridov
12/10/2021, 5:13 PMState
. I want to create function which changes state in different Component classes.
// external interface as example, but it will not work
external interface StateWithError: State {
var error: Throwable?
}
fun <S : StateWithError> Component<*, S>.someFunction(){
setState {
error = Throwable("Some msg")
}
}
I tried to use external interface
and abstract class
(even with @JsName("error")
), but always getting name mangling. Is there a way to create such function?Grégory Lureau
12/10/2021, 5:24 PMerror
? I'm thinking it could be a reserved word.turansky
12/10/2021, 5:26 PMNikolai Sviridov
12/10/2021, 5:39 PMNikolai Sviridov
12/10/2021, 5:39 PMturansky
12/10/2021, 5:44 PMNikolai Sviridov
12/10/2021, 5:49 PMCannot read properties of undefined (reading 'pass')
which likely related to another problemNikolai Sviridov
12/10/2021, 5:51 PMturansky
12/11/2021, 11:20 PMNikolai Sviridov
12/29/2021, 12:42 PMdata class WrapError(var error: Throwable?)
interface StateWithError: State {
var wrapError: WrapError
}
inline fun <S: StateWithError> Component<*, S>.setError(wrapError: WrapError) {
setState {
wrapError.error = Throwable("Say hello to my little friend")
}
}