question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript codegen

See original GitHub issue

We could generate TS types for the GraphQL queries in the project in parallel of something like graphql-document-collector to get the query docs globally.

I’ll work on this in a folder parallel to the swift/ folder.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:5
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
davidyahacommented, Oct 17, 2016

Yep cool! Would love to see both of these tools actually. Writing typings for objects created from graphql is driving me crazy… 😃

2reactions
rricardcommented, Oct 16, 2016

@davidyaha exactly. Right now, my main focus is client-side developer experience. Client side is usually harder and more error prone than client side in my own experience. This is still very much true with GraphQL where creating the schema is relatively easy but building a large app with large queries and such can become incrementally complex.

In the latest example you gave, to me, NestedObj may not require every field the type allows it to contain (see my example). However, NestedObjFragment can be a thing. My point is: here we’re going to be query-based, because that would help with the client DX. However, and I’m glad you brought that up, gql2ts is an amazing tool for server side! Because on the server you can virtually think that everything your schema is providing is immediately available. By the way, I would love having a gql2ts-kind of project available for flow as well!

This is some great stuff discussed here, I don’t think there will be one unique build tool for all of this but a bunch of complementary ones! (in a truly JS-fatigue manner, we’ll figure out later how we’ll make that work for beginners, let’s just start by experimenting!)

Read more comments on GitHub >

github_iconTop Results From Across the Web

ferdikoomen/openapi-typescript-codegen
NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification - GitHub - ferdikoomen/openapi-typescript-codegen: NodeJS ...
Read more >
graphql-codegen/typescript
GraphQL Code Generator plugin for generating TypeScript types. Latest version: 2.8.5, last published: 18 days ago.
Read more >
typescript
@graphql-codegen/typescript, Downloads, Version, License ... This plugin generates the base TypeScript types, based on your GraphQL schema.
Read more >
Is there code generation API for TypeScript?
When I needed to generate some C# code, for example DTO classes from xsd schema, or an excel table, I've used some roslyn...
Read more >
TypeScript GraphQL Code Generator
In this post, you'll learn how to use Apollo's GraphQL codegen to generate TypeScript types for GraphQL operations in your Apollo Client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found