DEV Community

Discussion on: Should we explicitly type the output of all functions (TypeScript) ?

Collapse
 
brandinchiu profile image
Brandin Chiu

I'd suggest yes whenever possible. Anyone coming from a strongly-typed language will understand immediately what the extra code is doing, so I wouldn't worry too much about that.

The major benefit besides is not for us, but for the language itself, especially when you start working with more objects, as it will help your application be explicit while it passes objects and models around.

It also makes it easier to find type errors before runtime.

Collapse
 
yanns1 profile image
Yann

Yes, I've a tendency to think that's better to explicitly type the output.
Thanks !