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

React: Change StoryFnReactReturnType to JSX.Element #23204

Merged
merged 5 commits into from Nov 29, 2023

Conversation

chakAs3
Copy link
Contributor

@chakAs3 chakAs3 commented Jun 23, 2023

Closes #

TypeCheck issue whenever we have a decorator like this

(Story) => (
      <>
        <p>Component Decorator</p>
        <Story />
      </>
    )

Story should return a valid JSX Element to be parsed in the template

What I did

StoryFnReactReturnType was set to ReactElement which is a general term used to refer to the objects that describe React components or HTML tags created using React.createElement() or JSX syntax.

However JSX.Element is a TypeScript type used to define the type of elements returned by JSX expressions,

and that is what StoryFn is actually returning

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@chakAs3 chakAs3 added maintenance User-facing maintenance tasks react labels Jun 23, 2023
@kasperpeulen kasperpeulen self-assigned this Jul 3, 2023
@ndelangen ndelangen changed the title React: Set StoryFnReactReturnType to JSX.Element React: Change StoryFnReactReturnType to JSX.Element Nov 29, 2023
@ndelangen ndelangen merged commit ea2acac into next Nov 29, 2023
66 of 72 checks passed
@ndelangen ndelangen deleted the chaks/react-storyfn-returntype branch November 29, 2023 11:54
@github-actions github-actions bot mentioned this pull request Nov 29, 2023
36 tasks
@github-actions github-actions bot mentioned this pull request Dec 7, 2023
44 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants