Data modeling is an important part of developing software. Once developed, data models are reflected in schemas, APIs, and object types, which all need to correspond. Managing this correspondence is often a difficult task, and is further still when working with multiple programming languages.
Though there are some tools for using GraphQL with TypeScript, they often have
requirements and constraints and result in limited opinionated adaptations.
gqx has been developed to provide an unopinionated conversion from
GraphQL schemas to TypeScript types, to allow developers to seamlessly integrate
the types as best suited for their programs.
To do this required using advanced TypeScript type features, including higher-kinded types, homomorphic mapped types, and distributive conditional types. This allows for complete type integration including autocompletion and exact result types.
Though I began working on the initial concept during development of a private
business application, I proposed and transitioned to working on
gqx as a
open-source utility, so that others can benefit from it.