In the following repository, it parses SQL into TypeScript type. No codegen tool is needed anymore.
https://github.com/codemix/ts-sql
The syntax should be like this:
// Query.ts
import { QueryFactory } from 'typed-graphqlify'
const schema = gql`
type Query {
hello: String!
}
`
export type Query<T> = QueryFactory<T, typeof schema>
// HelloQuery.ts
import { Query } from './Query'
const HelloQuery = gql`
{ hello }
`
type IHelloQuery = Query<typeof query>
// Equivalent to the following. Cool!
//
// type IHelloQuery = {
// data?: {
// hello: string
// }
// }
I think we can do the same thing in GrapQL.
I've started to work on this, will use next branch.
In the following repository, it parses SQL into TypeScript type. No codegen tool is needed anymore.
https://github.com/codemix/ts-sql
The syntax should be like this:
I think we can do the same thing in GrapQL.
I've started to work on this, will use
nextbranch.