Code-Hex / synchro

🕰️ Synchro: Timezone-typesafe date and time framework for Go. 🌟 Star to support our work!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider reordering the type params of ConvertTz

hsfzxjy opened this issue · comments

Currently ConvertTz has the following signature:

func ConvertTz[T TimeZone, U TimeZone](from Time[T]) Time[U]

Users have to specify both T and U at every call site like ConvertTz[T, U](...). However, if we change it to

func ConvertTz[U TimeZone, T TimeZone](from Time[T]) Time[U] // note that U and T are swapped

Users can simply call with ConvertTz[U](...) and let T be inferred from input arguments, which improves the ergnomics.