Skip to content

Instantly share code, notes, and snippets.

@romainbsl
Created January 27, 2020 20:14
Show Gist options
  • Save romainbsl/64658b49b307c59e988125264d07f143 to your computer and use it in GitHub Desktop.
Save romainbsl/64658b49b307c59e988125264d07f143 to your computer and use it in GitHub Desktop.
Kodein-DI TypeToken Native
@UseExperimental(ExperimentalStdlibApi::class)
inline fun <reified T> generic(): TypeToken<T> = NativeKTypeToken(typeOf<T>())
@UseExperimental(ExperimentalStdlibApi::class)
inline fun <reified T: Any> TT(obj: KClass<T>) : TypeToken<T> = NativeKTypeToken(typeOf<T>())
@UseExperimental(ExperimentalStdlibApi::class)
inline fun <reified T: Any> TTOf(obj: T) : TypeToken<T> = NativeKTypeToken(typeOf<T>())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment