Enable typegen by default in development
See original GitHub issueI think the Nexus defaults for typegen should be more helpful. I propose the following:
- Enabled by default when NOT production
- Output to
node_modules/@types/typegen-nexus/index.d.ts
We learnt from Nexus Framework that these are great defaults.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Enable typegen by default in development - - Bountysource
Enabled by default when NOT production; Output to node_modules/@types/typegen-nexus/index.d.ts. We learnt from Nexus Framework that these are great defaults.
Read more >GraphQL Typegen - Gatsby
By default, this feature is only generating files during gatsby develop . ... In the context of GraphQL Typegen fragments enable you to...
Read more >TypeGen attributes
TsDefaultExportAttribute¶. Used to specify if the generated TypeScript type should use a default export. There is also a possibility to enable default exports ......
Read more >Plugins configuration - Strapi Developer Docs
Enabled by default in if NODE_ENV is set to development . Boolean, false. shadowCRUD, Whether type definitions for queries, mutations and resolvers based...
Read more >makeSchema - GraphQL Nexus
7 typegen: path.join(__dirname, 'generated/nexusTypes.gen.ts'), ... There is no default behavior for this, but you could do something like the following, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You should run ts-node-dev with transpile only flag
Disclaimer: This could be entirely due to misconfiguration on my side, I find the makeSchema config object a bit confusing.
I’ve run into some trouble when leaving my typegen output out of source control, and that is that I lose portability of the project. When I clone my repo to another environment, I run
npm install
andprisma generate
which generates my prisma types fine, but when I start my project I get a lot of typescript type errors, usually on objectTypes that use custom scalars.i.e
If I comment out the field, allow the project to run successfully, the scalar is added to my generated types and I can then uncomment the field and it works as expected.
I’m assuming this could be fixed by keeping generated types in source control (currently I keep them in the recommended
node_modules/@types/typegen-nexus/index.d.ts
) but I could be wrong, and this might be unrelated to this discussion.