Amy Blankenship
Mar 29, 2022

--

While I agree with your main point (but not for the reasons you laid out), I also have to point out that TS is quite capable of inferring return types on functions. It's not going to error if you don't supply a return type unless a type in an obscure part of your code requires it or you said you were going to return something and didn't. setTimeout itself does not expect a return from the callback.

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

Responses (1)