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

[NO-TICKET] Upgrade React types to fix Storybook 8 branch #3080

Open
wants to merge 16 commits into
base: WNMGDS-2698/upgrade-storybook
Choose a base branch
from

Conversation

pwolfert
Copy link
Collaborator

Summary

  • Started out by upgrading the React types to the latest, trying to match @types/react and @types/react-dom as close as possible and made sure it was consistent everywhere
  • Then I started trying to knock out the 109 TypeScript errors
  • I found partway through that many of them could be reduced by cleaning up the yarn.lock file manually to get rid of old entries
  • I went back and reverted a few of my changes, but many of them were actually necessary
  • I changed the way the Dialog and Drawer stories are organized so that none of them pop up automatically. I then went back and added browser interaction tests to get the screenshots we want. Turns out that we were missing dialog screenshots for a while.

How to test

  1. yarn type-check
  2. yarn storybook
  3. Anything else you can think to check

Checklist

Planning to merge it into the other branch, and I think we'll want to put that branch into v11

pwolfert added 13 commits May 9, 2024 15:54
Here's the summary of errors we're starting with:

```
Found 109 errors in 28 files.

Errors  Files
     4  packages/design-system/src/components/Accordion/Accordion.stories.tsx:8
     3  packages/design-system/src/components/Alert/Alert.stories.tsx:6
     1  packages/design-system/src/components/Autocomplete/utils.tsx:15
    11  packages/design-system/src/components/ChoiceList/ChoiceList.stories.tsx:7
     4  packages/design-system/src/components/Drawer/Drawer.stories.tsx:29
    12  packages/design-system/src/components/Dropdown/Dropdown.stories.tsx:8
     6  packages/design-system/src/components/Dropdown/Dropdown.tsx:171
     1  packages/design-system/src/components/Dropdown/DropdownMenuOption.tsx:66
     5  packages/design-system/src/components/HelpDrawer/HelpDrawer.stories.tsx:29
     4  packages/design-system/src/components/IdleTimeout/IdleTimeout.stories.tsx:10
     4  packages/design-system/src/components/PrivacySettingsDialog/PrivacySettingsDialog.stories.tsx:17
     6  packages/design-system/src/components/Spinner/Spinner.stories.tsx:6
    23  packages/design-system/src/components/TextField/TextField.stories.tsx:10
     2  packages/design-system/src/components/Tooltip/Tooltip.tsx:357
     1  packages/design-system/src/components/UsaBanner/UsaBanner.stories.tsx:5
     1  packages/design-system/src/components/web-components/ds-accordion/ds-accordion.tsx:22
     1  packages/design-system/src/components/web-components/preactement/define.test.tsx:35
     1  packages/docs/src/components/content/ContentRenderer.tsx:111
     1  packages/docs/src/components/content/EmbeddedExample.tsx:17
     2  packages/docs/src/components/layout/SideNav/SideNav.tsx:25
     2  packages/docs/src/components/layout/TableOfContents.tsx:43
     1  packages/docs/src/components/page-templates/BlogPage.tsx:18
     1  packages/docs/src/pages/blog.tsx:33
     2  packages/ds-healthcare-gov/src/components/Accordion/Accordion.stories.tsx:8
     2  packages/ds-medicare-gov/src/components/Card/Card.stories.tsx:6
     5  packages/ds-medicare-gov/src/components/HelpDrawer/HelpDrawer.stories.tsx:31
     1  packages/ds-medicare-gov/src/components/SimpleFooter/SimpleFooter.stories.tsx:6
     2  packages/ds-medicare-gov/src/components/Stars/stars.stories.tsx:6
```
Add new interaction VRTs for dialog and drawer, and don't have any of the stories open them automatically
I was hoping fixing these types would do it.
…file

I think I'll go back and undo some of my previous commits to see if I need them
This reverts part of commit ffc035d.
@pwolfert pwolfert requested a review from zarahzachz May 10, 2024 00:27
It seems as though the type inference has gotten worse in this version. Instead of the type for Badge `size` being listed as `big` (only supports big), it is now reported as `literal`. For `string | React.ReactNode`, it only says `union`. Instead of `type` being `checkbox` and `radio`, it’s `union`. Instead of `ReactNode` for `React.ReactNode`, it prints out as `ReactReactNode`
@pwolfert
Copy link
Collaborator Author

Status update:

6811f4b shows that there were some significant regressions in Storybook's ability to infer TypeScript types and document them. Instead of the type for Badge size being listed as big (only supports big), it is now reported as literal. For string | React.ReactNode, it only says union. Instead of type being checkbox and radio, it’s union. Instead of ReactNode for React.ReactNode, it prints out as ReactReactNode. Neither are the args tables showing inherited properties anymore from things like UseHintProps. That last one's a big deal. Overall, the prop tables in the Storybook docs are a much less accurate representation of our props, which makes this dead in the water for now.

I also did some investigating into the yarn lockfile changes, and I made sure that all the "docgen"-related packages were either going up in version number or staying the same, just to rule out the possibility that we might literally be going backwards.

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.

None yet

1 participant