graphql-static-binding icon indicating copy to clipboard operation
graphql-static-binding copied to clipboard

(Optionally) include typeDefs in generated .ts (.js) file

Open PatrickVanRietschoten opened this issue 7 years ago • 2 comments

I'd like to use my own bindings in the browser, but the typeDefs aren't available (fs.readFile). A solution is to import the typeDefs separately (fetch in the browser). But I'd prefer to have the typedefs available in the generated .ts file, like Prisma does.

Could this be included in the default generator? (binding-ts) .

(Or maybe have this available as option for the default generator)

PatrickVanRietschoten avatar Jan 31 '18 13:01 PatrickVanRietschoten

I like the idea, but I'd like to get some more feedback on this. Including typeDefs by default for a large schema will significantly increase file size. On the other hand, you'll need the schema anyway, so it might just as well be in that file.

Re configuration option. I currently don't see other cases for providing configuration options, so I don't want to do that right now. The issue being that such options will bubble up all the way to either graphql prepare command line options, or additional graphql-config extension options.

kbrandwijk avatar Jan 31 '18 13:01 kbrandwijk

I agree that configuration option for this might be an overkill 👍 If default including is not desired, we could also make a binding-typedefs-ts . But I think that default including is better.

PatrickVanRietschoten avatar Jan 31 '18 19:01 PatrickVanRietschoten