You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once apollo-codegen generated source produces a fully-typesafe callable function directly from a .graphql source file (a la #308), what I'd love to see is to convert/wrap apollo-codegen into a webpack-style loader where you load a .graphql file, and it exports the mentioned typesafe functions directly.
The idea is to add the loader, somehow point it to an existing schema.json file, and when you import from a .graphql/.gql file it automatically generates everything you need without any generation step. Like a higher-level graphql-tag loader.
import{FetchResturants}from'./myquery.graphql';// no running `apollo-codegen generate` , creating or checking in additional files, etc.functiondoStuff(client: GraphQLClient){// okFetchResturants(client,"1a3fd").subscribe((result)=>{console.log(result.data.fetchMenuItem[0].categoryId);});// type error: FetchResturants takes a string not an integerFetchResturants(client,123).subscribe((result)=>{// type error: fetchMenuItem has no property named `category` (it's `categoryId`)console.log(result.data.fetchMenuItem[0].category);});}
These libraries are so close to a completely typesafe but also trivial to use api surface all the way from the server through client libraries into UI components via GraphQL I can taste it.
The text was updated successfully, but these errors were encountered:
Once apollo-codegen generated source produces a fully-typesafe callable function directly from a
.graphql
source file (a la #308), what I'd love to see is to convert/wrap apollo-codegen into a webpack-style loader where you load a.graphql
file, and it exports the mentioned typesafe functions directly.The idea is to add the loader, somehow point it to an existing
schema.json
file, and when you import from a.graphql
/.gql
file it automatically generates everything you need without any generation step. Like a higher-levelgraphql-tag
loader.This is is the experience I would hope for:
[myquery.graphql]
[mycode.ts]
These libraries are so close to a completely typesafe but also trivial to use api surface all the way from the server through client libraries into UI components via GraphQL I can taste it.
The text was updated successfully, but these errors were encountered: