graffle-js / graffle

Simple GraphQL Client for JavaScript. Minimal. Extensible. Type Safe. Runs everywhere.
http://graffle.js.org/
MIT License
5.85k stars 308 forks source link

V8. Generated types location #1220

Closed ziimakc closed 49 minutes ago

ziimakc commented 2 hours ago

Maybe it makes sense to move generated types into node_modules and expose them like prisma does?

import { Generated } from "graffle/generator";

const data: Generated.UserQuery = {...}

Reasoning:

jasonkuhrt commented 2 hours ago

If you install dprint it will be formatted. Regarding file naming conventions I will expose an option for that.

Regarding how Prisma does it, I'm not closed to that however it's more complex for many reasons so wouldn't prioritize it now.

You could emit to node_modules/@types/graffle-generated, but that wouldn't solve the runtime parts that still need importing for some features.

jasonkuhrt commented 1 hour ago

Related https://github.com/graffle-js/graffle/issues/1144