The big trend for a while now has been GraphQL and its associated technologies growing popularity among the dev community. However there’s also another language that has been making the rounds, namely TypeScript. Last year it became the 4th most popular programming language on GitHub. If you’re looking to get ahead of the curve it’s probably high time to get to know both and if not it’s always good to check out what’s new in the community. Anyway let’s take a look at what using Typescript with GraphQL can do for you.
If only there was a way to make it all easier. Well as you might’ve guessed it we’re in luck there’s a little thing which can do a lot of the work for us, a framework aptly named TypeGraphQL.
Normally you’d have to write all the schema types using SDL, create data models using ORM classes, write resolvers for all the queries, mutations and fields and create TypeScript interfaces for all arguments, inputs and object types. After all that you can implement the resolvers using generic signatures and you’ll still need to manually do things like validation, authorization and loading dependencies. This leads to a lot of code redundancy as changing a type in one place will require making changes in a number of places from the schema to the interface. It’s also obviously tiresome as a single mistake will make you double check everything again. This is where TypeGraphQL comes in.
TypeGraphQL is currently in version 1.0 and has a lot of plans for the future which looks pretty bright with how popular both GraphQL and TypeScript are becoming. The easy to see conclusion is that combining the strengths of TypeScript and GraphQL leads to a properly structured code, which is easy to reuse, maintain and scale. Yes there is some learning curve and initial growing pains needed to get a hang of all the kinks and features but the payoff is already substantial and will only grow as more projects start to use both technologies. That looking at the trends seems to be inevitable.
The GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster thanks to dozens of built-in micro features. Its graphical interface will also fix communication within your product team. Visualization is the key!