-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
We have a field in 8 content types called 'content_slot' - each one is similar, but mostly unique. The generator is outputting 8 duplicates of interface ContentType - which makes them indistinguishable from the parent content type they should be associated with. This causes type errors in the final output, and each of the 8 content types all reference content_slot?: ContentSlot[];. There are also large subtype objects that could be pulled out into a single interface but that's more of an optimization issue, not the root issue.
Example: Duplicate interface declarations with conflicting property types
// First declaration
export interface ContentSlot {
cms_content: {
slot_name?: string;
content_ref?: (TypeA | TypeB)[];
slot_options?: object;
// ...other fields
};
// ...other fields
}
// Second declaration (conflicting type for cms_content.content_ref)
export interface ContentSlot {
cms_content: {
slot_name?: string;
content_ref?: (TypeC | TypeD)[];
slot_options?: object;
// ...other fields
};
// ...other fields
}
TypeScript error:
Subsequent property declarations must have the same type.
Property 'cms_content' must be of type '{ slot_name?: string; content_ref?: (TypeA | TypeB)[]; ... }',
but here has type '{ slot_name?: string; content_ref?: (TypeC | TypeD)[]; ... }'.
A quick fix might be to allow prefixing specific types with their parent content type.
Metadata
Metadata
Assignees
Labels
No labels