Skip to content

type definition does not match code for registerWidget? #5970

@usernamenumber

Description

@usernamenumber

Describe the bug

I'm willing to submit a PR to address this, but want to be sure I'm not misunderstanding something first...

The CMS.registerWidget() source takes four arguments:

export function registerWidget(name, control, preview, schema = {}) { ... }

but the typescript interface exported for it doesn't include the schema argument

registerWidget: (
      widget: string | CmsWidgetParam,
      control?: ComponentType<CmsWidgetControlProps> | string,
      preview?: ComponentType<CmsWidgetPreviewProps>,
) => void;

Additionally, the actual registerWidget function checks whether its first argument is an array, and if it is calls its self on each member of the array, but the typescript interface does not recognize this usage as valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions