Skip to content

React: Change StoryFnReactReturnType to JSX.Element#23204

Merged
ndelangen merged 5 commits into
nextfrom
chaks/react-storyfn-returntype
Nov 29, 2023
Merged

React: Change StoryFnReactReturnType to JSX.Element#23204
ndelangen merged 5 commits into
nextfrom
chaks/react-storyfn-returntype

Conversation

@chakAs3
Copy link
Copy Markdown
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
@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.

3 participants