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

Improve types for builtin editor widget IDs #1462

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

nib-bturner
Copy link
Contributor

Summary

Currently its pretty easy to mistype or put the wrong widgetId when changing editor interfaces. This PR introduces function overloading to the index.d.ts file to restrict this from string to the widget IDs listed in your website:
https://www.contentful.com/developers/docs/extensibility/app-framework/editor-interfaces/.

Description

Motivation and Context

I'm sick of guessing the wrong widgetId and would prefer a nicer developer experience. Copying these changes locally into our production application very clearly shows when there is an invalid widgetId for a builtin widget. Examples:

image

This catches these errors before they happen (number is not a valid widgetId)
image

Todos

  • Implemented feature
  • Feature with pending implementation

Screenshots (if appropriate):

@nib-bturner nib-bturner marked this pull request as ready for review January 30, 2025 00:58
@nib-bturner nib-bturner requested a review from a team as a code owner January 30, 2025 00:58
Copy link
Contributor

@whitelisab whitelisab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @nib-bturner! This is a helpful DX improvement when working with the builtin widgetIds. Approving and merging! ⭐

@whitelisab whitelisab merged commit 5a4086f into contentful:main Jan 31, 2025
6 checks passed
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.

2 participants