Skip to content

Commit cd682a4

Browse files
committed
fix: handle duplicate modular block
1 parent 999ad27 commit cd682a4

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

src/lib/tsgen/factory.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ export default function (userOptions: TSGenOptions) {
238238
function visit_content_type(
239239
contentType: ContentstackTypes.ContentType | ContentstackTypes.GlobalField
240240
) {
241+
modularBlockInterfaces.clear();
241242
const contentTypeInterface = [
242243
options.docgen.interface(contentType.description),
243244
define_interface(contentType, options.systemFields),
@@ -252,18 +253,6 @@ export default function (userOptions: TSGenOptions) {
252253

253254
return [...modularBlockInterfaces, contentTypeInterface].join('\n\n');
254255
}
255-
256-
function visit_modular_block(
257-
field: ContentstackTypes.Field,
258-
block: ContentstackTypes.Block
259-
) {
260-
return (
261-
'{' +
262-
[block.uid + ':', block.reference_to ? name_type(block.reference_to as string) + ';' : '{' + visit_fields(block.schema || []) + '};'].join(' ') +
263-
visit_block_names(field, block) +
264-
'}'
265-
)
266-
}
267256

268257
function type_modular_blocks(field: ContentstackTypes.Field): string {
269258
const blockInterfaceName = name_type(field.uid);

0 commit comments

Comments
 (0)