News for hackers. Stuff that matters.
Re:Do Not Follow JavaScript Trends by nisten on Tuesday June 16, 2020 @01:47PM (#23541917)
I would avoid doing state management in Typescript. It's still too early in my opinion.

Use as many hooks and context as possible and keep your redux store as simple as you possibly can because if you end up with a deprecated state management library (redux-thunk, sagas, easy-peasy) replacing that is like pulling gum out of hair.

If you add up the time spent working around typescript errors when dealing with state, it's possible for it to be more time than you need to rewrite the entire app.

For backend work then yes, I'd say doing a singleton or an abstract class in typescript makes more sense in hardening your API code and even making it more readable too.

Re:Do Not Follow JavaScript Trends by acemarke on Tuesday June 16, 2020 @02:36PM (#23542542)
I'm a Redux maintainer, and I'm _strongly_ in favor of using TypeScript for any meaningful app development [0] [1].

Also, I don't know why you're referring to thunks and sagas as "deprecated". Thunks are the recommended default approach for async logic in Redux [2], and we include them out of the box in our Redux Toolkit package [3]. While most apps don't need sagas, they're a great power tool to have in your toolbox. Neither of those is in any way "deprecated".

[0] https://blog.isquaredsoftware.com/2019/11/blogged-answers-le...

[1] https://redux.js.org/style-guide/style-guide#use-static-typi...

[2] https://redux.js.org/style-guide/style-guide#use-thunks-for-...

[3] https://blog.isquaredsoftware.com/2020/02/blogged-answers-wh...

Re:Do Not Follow JavaScript Trends by nisten on Tuesday June 16, 2020 @09:10PM (#23546510)
Sorry I meant as in an older version of a library that an app has been built on and hasn't been updated or maintained for a few months.

I should have put that better, the libraries themselves are not deprecated, their dependencies can be.

While this negligence problem would be on the fault of the dev team and management for not doing regular package updates it is an all too common issue in many companies.

What I am saying is that bad typescript is harder to fix than bad javascript because type errors compound the problems of convoluted code.