Skip to content

Commit 146fa96

Browse files
committed
refactor: update JSON fields type definitions handling in enhance function
1 parent 9c650e6 commit 146fa96

File tree

1 file changed

+3
-9
lines changed
  • packages/schema/src/plugins/enhancer/enhance

1 file changed

+3
-9
lines changed

packages/schema/src/plugins/enhancer/enhance/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,18 +492,12 @@ export type Enhanced<Client> =
492492
private async processClientTypesNewPrismaGenerator(prismaClientDir: string, delegateInfo: DelegateInfo) {
493493
const project = new Project();
494494

495-
// Create a shared json-fields.ts file for all JSON fields type definitions
496-
const jsonFieldsFile = project.createSourceFile(path.join(this.outDir, 'json-fields.ts'), undefined, {
495+
// Create a shared file for all JSON fields type definitions
496+
const jsonFieldsFile = project.createSourceFile(path.join(this.outDir, 'json-fields.d.ts'), undefined, {
497497
overwrite: true,
498498
});
499499

500-
// Generate all JSON fields type definitions in the shared file
501-
for (const decl of this.model.declarations) {
502-
if (isTypeDef(decl)) {
503-
generateTypeDefType(jsonFieldsFile, decl);
504-
}
505-
}
506-
500+
await this.generateExtraTypes(jsonFieldsFile);
507501
await jsonFieldsFile.save();
508502

509503
for (const d of this.model.declarations.filter(isDataModel)) {

0 commit comments

Comments
 (0)