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.

GraphQL is a recent standard for defining schemas, queries, and types. It is designed to be adapted to any programming language, primarily so that it can be used to define APIs which may be used by a variety of software. TypeScript is a popular language that extends JavaScript with data types. Though GraphQL is designed to be adapted to any programming language, the specifics of that are at the option of the software developer.

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.