When generating types for the server-side the names are not too much of an issue but for the client side they become a little bit too ugly to look at.
E.g. "NewsfeedNewsfeed", "NewsfeedCommentNewsInlineFragment", "AnsweredQuestionAnsweredQuestion", "NotificationFieldsNewCommentInlineFragment", "UserUser"etc.
Logically it all makes sense generating such names but in terms of readibility I'm afraid it doesn't. The solution that comes to mind is to simply write all the ts types manually but this opens too many places for mistakes. Any ideas?
P.s. great work
I have the same questions. I've tried with namespaces but then had real difficulties using them in my CRA application (CRA shows me namespaces are not supported)
For the time being I gave up and live with "ugly" names like AnsweredQuestionAnsweredQuestion
Hi @zenVentzi !
We are currently working on rewriting the TypeScript plugins (https://github.com/dotansimha/graphql-code-generator/pull/1353). We removed namespaces completly, and now we are using Pick<> to generate the result of queries. It means that each query will have only a single TypeScript type, and there will be no duplications/mis-matches/ugly names - only the name of the operation.
@SekibOmazic
Fix available in 1.0.0 馃憤
Most helpful comment
Hi @zenVentzi !
We are currently working on rewriting the TypeScript plugins (https://github.com/dotansimha/graphql-code-generator/pull/1353). We removed
namespaces completly, and now we are usingPick<>to generate the result of queries. It means that each query will have only a single TypeScripttype, and there will be no duplications/mis-matches/ugly names - only the name of the operation.@SekibOmazic