Skip to content

Commit

Permalink
Merge pull request #103 from pawelgrzybek/master
Browse files Browse the repository at this point in the history
fix: add support for string as a filter_content_type
  • Loading branch information
Edo-San authored Jul 9, 2024
2 parents a81c099 + b8d9fbd commit 4b95daf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/generate-typescript-typedefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type ComponentPropertySchema = {
component_whitelist?: string[];
email_link_type?: boolean;
exclude_empty_option?: boolean;
filter_content_type?: string[];
filter_content_type?: string | string[];
key: string;
options?: ComponentPropertySchemaOption[];
pos: number;
Expand Down
6 changes: 6 additions & 0 deletions src/utils/typescript/generateTypesFromJSONSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ export class GenerateTypesFromJSONSchemas {

if (property.source === "internal_stories") {
if (property.filter_content_type) {
if (typeof property.filter_content_type === "string") {
return {
tsType: `(${this.#getStoryType(property.filter_content_type)} | string )${property.type === "options" ? "[]" : ""}`,
};
}

return {
tsType: `(${property.filter_content_type
.map((type2) => this.#getStoryType(type2))
Expand Down

0 comments on commit 4b95daf

Please sign in to comment.