I get that critique for smaller apps. It doesn't buy you a whole lot for this 60-liner. But for the large React app with a complex state tree I work on in my day job, Typescript has been incredible. Having the Typescript compiler say "nope" immediately when you've done something wrong is incredibly helpful, and the associated linting means I usually catch it as I'm typing.
I really do not see the point of TS. The 'types' in the above code buy you nothing whatsoever
I get that critique for smaller apps. It doesn't buy you a whole lot for this 60-liner. But for the large React app with a complex state tree I work on in my day job, Typescript has been incredible. Having the Typescript compiler say "nope" immediately when you've done something wrong is incredibly helpful, and the associated linting means I usually catch it as I'm typing.
Using TS is an investment. It will payoff in the long run. It will actually make you write less code. An a more solid code