Unfortunately I don't think this is possible as the compiler will find a common supertype such as "Any" and use it. You could have concrete functions to do this for common types that you use but the generic version will always allow type widening due to how Kotlin's type inference works.