Skip to content

toErrorSchema docs example is invalid with strict TypeScript types #4558

@TheOneTheOnlyJJ

Description

@TheOneTheOnlyJJ

Prerequisites

What theme are you using?

core

Version

5.24.7

Current Behavior

When strictly typing toErrorSchema inputs as RJSFValidationError[], the docs example is invalid because a RJSFValidationError must also specify the stack property. The list of alleged example RJSFValidationErrors in the docs specifies only the property and message properties, missing the stack.

Expected Behavior

No error when strongly typing docs examples.

Steps To Reproduce

  1. Take the docs example and strictly type it.
  2. Notice this:

Image

  1. Giving this error:

Image

Environment

Irrelevant

Anything else?

Maybe a new type should be introduced for custom user errors. Even a simple Partial<RJSFValidationError> would
superficially resolve the error. I am unsure if anything further down would break by doing this, though.

This issue was discovered while trying to get around #4553, which I did.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions