Member-only story
Generate Javascript static types from GraphQL: TypeScript and Flow
(This article is also available at atheros.ai without the paywall.)
Introduction
Javascript is usually considered as an untyped or weakly-typed language. I will not go into the discussion about this topic in this article. You can check out for example this StackOverflow thread for more information. We currently cannot prove the correlation between using statically/dynamically typed languages and number of defects in the system, but there are some evidences that errors occur less when using statically typed language. You can go more deeply into the topic in the following study. In addition statically typed languages can offer smart tooling integrated in your IDE, which enables you to perform more complex autocompletion and linting. Javascript is one of the most widely spread and demanding language. You can use it for frontend, backend or even mobile development. Javascript has definitely a lot of advantages, but as it is untyped it does not support static typings by default. Fortunately, we can enhance the Javascript language using the following tools to add static typings to our project:
Flow is open-sourced by Facebook and we are able to perform type checking with a Flow server while coding. On the other…