Skip to content
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

Fix typings for EditorComponentField #7160

Merged
merged 3 commits into from Mar 28, 2024

Conversation

mathiasandresen
Copy link
Contributor

Summary
It was not possible for me to add new widgets with correct typing, since I was required to set field and fields for non 'list' widgets.
So I modified the types to be a discriminated union, that only allows setting field and field when widget is equal to 'list'.

image

Test plan

Checklist

Please add a x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)

@mathiasandresen mathiasandresen requested a review from a team as a code owner March 25, 2024 08:56
@mathiasandresen mathiasandresen changed the title Fix/editor component type Fix typings for EditorComponentField Mar 25, 2024
@martinjagodic martinjagodic requested review from demshy and removed request for a team March 25, 2024 09:11
@frankiereyes
Copy link

I just ran into this same issue when referencing the documentation for registering an editor component:
https://decapcms.org/docs/custom-widgets/

@chrisleyva
Copy link

@mathiasandresen great fix!
👍 I also ran into this issue.

@demshy demshy merged commit 4262b63 into decaporg:main Mar 28, 2024
9 checks passed
@demshy
Copy link
Member

demshy commented Mar 28, 2024

released as decap-cms@3.1.5

yuri-g-taboola pushed a commit to taboola/decap-cms that referenced this pull request May 22, 2024
* fix: make EditorComponentField type handle widget='list' correctly

* fix: make field and fields optional for widget='list'

---------

Co-authored-by: Anze Demsar <anze.demsar@p-m.si>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants