Allow generate types from `gql` with typescript-server plugin
See original GitHub issueDescribe the feature
Allow generate types from gql
with typescript-server plugin. Currently you can generate them from ‘String’ types but it could be interesting to allow generate them from gql
function (import { gql } from ‘graphql-tag’), in this case you might take advantage of plugins for highlighting, linting & prettifying .
Current: (It works!)
const typeDefs = `
extend type Query {
capsules(): [Capsule]
capsule(capsule_serial: String!, id: Boolean): Capsule
}
`
Proposal: (It doesn’t work)
const typeDefs = gql`
extend type Query {
capsules(): [Capsule]
capsule(capsule_serial: String!, id: Boolean): Capsule
}
`
This throws The Query definition is not executable.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Generating types from a GraphQL schema
The typescript-resolvers plugin creates a Resolvers type that you can use to add a type to your resolver map, ensuring your resolvers return...
Read more >typescript - GraphQL Code Generator
This plugin generates the base TypeScript types, based on your GraphQL schema. The types generated by this plugin are simple, and refers to ......
Read more >Automatically generate Typescript types for your GraphQL ...
graphql-codegen is a tool that automatically generates Typescript types from GraphQL types and resolvers definition. What are we going to build.
Read more >Generate TypeScript Types from a GraphQL Schema - YouTube
Automatically generate types for your local or remote GraphQL schema, and operations for better type -safety.Learn more about #GraphQL ...
Read more >How to Generate Typescript Types for GraphQL in React Project
-codegen/cli: core command line file · -codegen/typescript: plugin to generate typescript types · -codegen/typescript-react-apollo: plugin to generate react ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@swcarlosrj Why do you have
documents
? Do you usetypescript-client
package or related?documents
are basically operations and fragments, so something client-side.schema
should point to a schema or typeDefsI guess you use typeDefs, so replace
documents
withschema
and put the glob there.@swcarlosrj You’re not alone that uses
documents
this way. @dotansimha maybe we could improve docs or something?