Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Merge generated types with existing ones #8

Closed
zingerj opened this issue Mar 23, 2020 · 3 comments
Closed

Merge generated types with existing ones #8

zingerj opened this issue Mar 23, 2020 · 3 comments

Comments

@zingerj
Copy link

zingerj commented Mar 23, 2020

Love this tool so far, so thanks for your work here! I was wondering about the possibility of merging in the generated types with existing custom ones that may be unrelated to prisma2.

I see that the current behavior allows me to define additional files in src/types as long as the names don't collide and they won't be overwritten. However, running cnt does overwrite the index.ts file, which forces me to re-export the custom files each time.

Would it be possible to allow for custom types alongside the generated ones in the files, or at least add all files in the types directory back to index.ts once generation has finished?

@AhmedElywa
Copy link
Collaborator

Hey @zingerj, what i do in my project i create this files in src/types/models folder and Queries in src/types/queries Mutations src/types/mutations and any custom types i create it into the file i use it

Example i need to create custom input for query i will create input type in this query file

I hope this help you because looking to old file not an option in my tool

Thanks

@zingerj
Copy link
Author

zingerj commented Mar 23, 2020

Ah okay, makes sense. I'm still a little unclear though. Could you provide a quick example to help me understand?

@AhmedElywa
Copy link
Collaborator

image
like you see i have src/types folder inside it i have models folder this generated files by my tool and other two folder for my custom work

you can change your out put dir by this flag --outDir=src/types/models

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants