See this discussion, especially the end. TL;DR: your best bet now is to rely on the type inference of the compiler (as you do above), but this may change in the future.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Combinators on Nullables | 7 | 1371 | January 21, 2017 | |
| Lazy broadcast Nullable | 10 | 1061 | July 4, 2017 | |
| How to write type stable code with branches, where one branch calls a complicated function? | 14 | 922 | September 20, 2023 | |
| Type stable Base.return_types - is it possible? | 21 | 714 | September 6, 2025 | |
| How do I get the expected return type of a polymorphic function at compile time? | 15 | 1813 | February 7, 2019 |