Ayfri
02/14/2022, 5:26 AMinline fun <T : Any> T.create(block: T.() -> Unit) = jso(block)
But the receiver type is of the companion object of the class and doesn't work if the class doesn't have any companion object, so this is not what I want
I want to be able to do AnyClass.create { }
and have the receiver equal to the receiver when doing AnyClass().apply { }
ilya.gorbunov
02/14/2022, 5:29 AMilya.gorbunov
02/14/2022, 5:33 AMAyfri
02/14/2022, 2:22 PMTim Oltjenbruns
02/14/2022, 2:46 PMinline fun <T : Any> KClass<T>.create(block: KClass<T>.() -> Unit) = jso(block)
and AnyClass::class.create {}
Tim Oltjenbruns
02/14/2022, 2:47 PM