Closed martinszeltins closed 2 years ago
It doesn't really make sense to generate the TS files from the backend.
You can do it with the frontend from the schema. You should check this: https://www.graphql-code-generator.com/
There is a bunch of awesome generators for Typescript and other GQL clients.
@Vincz @mcg-web I do use Attributes for Generating the GraphQL Queries and types. But then It would be perfect if those schemas can be generated for typescript use
Hi @wesleylether. As state in my previous comment, you can easily generate your Typescript stuff based on your schema. Did you try this: https://the-guild.dev/graphql/codegen? You just need to dump your graphQL schema after everything is configured properly with attributes and stuff, and generate your Typescript types from this schema.
@Vincz Ahh my apologies. I did not know there was a dump graphQL schema option 😊 ! Thanks this is perfect indeed
When working with TypeScript on the frontend, it would be nice if it was possible to have TypeScript types automatically generated. Perhaps, it would be possible to add a Symfony command
generate:typescript
or something like that, which in turn would create agraphql.ts
file with all TypeScript type definitions?A workaround for me has been to take the generated
schema.graphql
and manually by hand convert it to TypeScript.For example: