Open
Description
I suggest to not typealias anything in a multiplatform date/time library.
- It mixes platform-provided API into the library's API which causes confusion and is platform-dependent.
- It doesn't allow for adding a companion and thus "static" functionality - not even through extensions.
For example:
I had code in the back-end that used Month.of(someInt)
. The code was relatively simple and there were no JVM-specific imports. So I've moved it to a shared multiplatform dependency and was surprised that Month.of()
was no longer available. Month.<autocomplete>
didn't provide me with any useful alternative.
After Cmd-clicking on Month
I've learned that it is merely a typealias on JVM. It took a while to figure out that there's an additional Month(Int)
function in kotlinx-datetime that I should've used instead. Scenarios like that can easily lead to confusion and inconsistency.