Hacker News new | ask | show | jobs
by johnsoft 2227 days ago
>A lot of time is spent figuring out what ”types” to return.

Typescript infers return types, so even if you don't write out a return type, it will still be fully typed.

If you still want to specify the return type, you can take advantage of IDE support. Write the function without an explicit return type, then you can hover over it to see the inferred type, then copy the type.

In my preferred IDE (PyCharm), it's even easier since there's a lightbulb action for it. Alt+Enter > "Specify return type explicitly" > Enter