Skip to content

Commit 4f1cced

Browse files
committed
Generated relation types are now shallow, BREAKING CHANGE
Before this, fields in a <Model>Relations type would reference <OtherModel>Relations type, which would often reference <Model>Relations type itself, leading to infinite nesting. Now instead the fields reference <OtherModel>
1 parent 6ed3d90 commit 4f1cced

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

packages/generator/src/functions/contentWriters/writeModelOrType.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,7 @@ export const writeModelOrType = (
222222
.write(field.name)
223223
.conditionalWrite(!field.isRequired, '?')
224224
.write(': ')
225-
.conditionalWrite(
226-
!field.isCompositeType,
227-
`${field.type}WithRelations`,
228-
)
229-
.conditionalWrite(field.isCompositeType, `${field.type}`)
225+
.write(`${field.type}`)
230226
.conditionalWrite(field.isList, '[]')
231227
.conditionalWrite(!field.isRequired, ' | null')
232228
.write(';')

packages/generator/src/functions/fieldWriters/writeModelRelation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const writeRelation = ({
2121
// fields are optional.
2222
.conditionalWrite(isPartial, 'Partial')
2323
.conditionalWrite(isOptionalDefaults, 'OptionalDefaults')
24-
.conditionalWrite(!field.isCompositeType, 'WithRelations')
2524
.write('Schema)');
2625
writeFieldAdditions({ writer, field, writeOptionalDefaults });
2726
};

0 commit comments

Comments
 (0)