Closed PuruVJ closed 3 years ago
You can add it to the branch @PuruVJ, I think the refactor is essentially done, except for checking your changes.
My changes are barely anything. They don't change a bit.
And yes, I'm gonna do it in the branch only.
No need for cleanup. I've set up typings for the fields that we'd need.
Great
We should introduce a function to clean up unneeded data (like contexts, annotations) responseJSON that's returned from the fetch requests.
Why
676 is all about introducing JSDoc typings. It is to provide typescript like intellisense experience while editing. You press Ctrl + Space, you get all the properties, their types, descriptions, whether they are optional or not. This alone will reduce lot of bugs during coding.
And as all these types will be defined in another file, which will just be full of comments , so nothing will break, no cognitive load for anyone else(due to the fact that these would be in a separate file).
responseJSON
returned by the Twitter API contains way too much stuff. We are using only a fraction of those, so we need to get rid of others.responseJSON = cleanupResponse(responseJSON)
would work perfectly, and should happen in thefetch
util itself.How
While @johnjacobkenny and @Mira-Alf are doing the refactoring, I will make myself useful by introducing the cleanup function and JSDoc typings.