-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Repeatable #360
Add Repeatable #360
Conversation
src/types/value/repeatable.ts
Outdated
* A list of repeatable fields. | ||
*/ | ||
export type Repeatable< | ||
Fields extends Array<AnyRepeatableField> = Array<AnyRepeatableField>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is right, because when AnyRepeatableField
is composed of more than one field the array won't be homogeneous.
src/types/value/repeatable.ts
Outdated
* A list of repeatable fields. | ||
*/ | ||
export type Repeatable< | ||
Fields extends Array<AnyRepeatableField> = Array<AnyRepeatableField>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fields extends Array<AnyRepeatableField> = Array<AnyRepeatableField>, | |
Fields extends AnyRepeatableField, |
src/types/value/types.ts
Outdated
/** | ||
* Any field that can be repeated. | ||
*/ | ||
export type AnyRepeatableField = LinkField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type AnyRepeatableField = LinkField | |
export type AnyRepeatableField = Repeatable<LinkField> |
src/types/value/types.ts
Outdated
@@ -46,6 +52,7 @@ export type AnyRegularField = | |||
| BooleanField | |||
| GeoPointField | |||
| IntegrationField | |||
| Repeatable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Repeatable | |
| AnyRepeatableField |
Update src/types/value/types.ts
…smic-client into dani/repeatable-links-alt1
…smic-client into dani/repeatable-links-alt1
…smic-client into dani/repeatable-links-alt1
src/types/value/link.ts
Outdated
* A repeatable link field. | ||
*/ | ||
|
||
export type RepeatableLinkField = Repeatable<LinkField> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lihbr @angeloashmore i believe here we need to add to RepeatableLinkField
the same type params of the LinkField
, and forward them, right?
btw, i still feel that we don't need this extra type declaration, but let me know if you still want to keep it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we don't need this. Repeatable<LinkField>
is self-descriptive and more flexible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes based on the call we had yesterday. Let me know if things changed since then, but I prefer using a utility type (Repeatable
) over field-specific types (RepeatableLinkField
).
src/types/value/link.ts
Outdated
* A repeatable link field. | ||
*/ | ||
|
||
export type RepeatableLinkField = Repeatable<LinkField> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, we don't need this. Repeatable<LinkField>
is self-descriptive and more flexible.
src/helpers/isFilled.ts
Outdated
* @returns `true` if `repeatable` contains at least one item, `false` | ||
* otherwise. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/types/value/types.ts
Outdated
@@ -35,6 +35,7 @@ export type AnyRegularField = | |||
| ImageField | |||
| ContentRelationshipField | |||
| LinkField | |||
| RepeatableLinkField |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| RepeatableLinkField | |
| Repeatable<LinkField> |
Co-authored-by: Angelo Ashmore <angeloashmore@users.noreply.github.com>
…smic-client into dani/repeatable-links-alt1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
* chore: bump types-internal dep * feat: support repeatable links in models * Bump types internal * Remove repeat from content rel. and link to media * Add Repeatable (#360) * Add Repetable to index * chore(release): 7.13.0-alpha.0 * Use stable types internal --------- Co-authored-by: Daniel Martín <danimartinprieto@gmail.com>
Resolves:
Alternative 1 for adding support to repeatable links. Creates a wrapper type similar to Group.
Description
Checklist
Preview
How to QA 1
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩