graphql-devtools icon indicating copy to clipboard operation
graphql-devtools copied to clipboard

fix ts types

Open dielduarte opened this issue 4 years ago • 4 comments

dielduarte avatar Mar 30 '20 02:03 dielduarte

Let's start a discussion here and define what we want, so we have a plan to "fix" this issue and @dielduarte adds in the issue description a list as we agree in new things. I would start suggesting to use types over an interface, there are many articles comparing both, such as interface vs type alias. The point is that type makes more sense semantically for our use, we are mainly using it for type inference and not as an interface to be implemented. Another big point here is that type alias allows you to play better with advanced types of the typescript as the projects grow more complex.

assuncaocharles avatar May 12 '20 21:05 assuncaocharles

I've had read the post and that makes sense in our case, the main point is to keep consistency in the codebase.

to get rid of this "issue" here, I would suggest a few changes in our codebase:

  • move from interfaces to types
  • get rid of details: any adding a global type definition, this is about the details params returned by the WebRequest API events callbacks https://developer.chrome.com/extensions/webRequest
  • get rid of requestExist = (context: any, this context is about CoreContext

what do you think @assuncaocharles ?

dielduarte avatar May 12 '20 23:05 dielduarte

It works for me

  • [ ] Replace interface for types
  • [ ] Get rid of requestExist = (context: any, this context is about CoreContext
  • [ ] Get rid of details: any adding a global type definition, this is about the details params returned by the WebRequest API events callbacks

assuncaocharles avatar May 13 '20 13:05 assuncaocharles

@assuncaocharles niceeee! let's do it 🚀

dielduarte avatar May 13 '20 13:05 dielduarte