react-docgen issues related to flow upgrade
See original GitHub issueA couple of issues found with recent flow changes, documented by @oliviertassinari and consolidated here.
I’ll be working these issues into PR #9203
- react-docgen doesn’t mark defaulted properties as optional (PR)
-
classes
missing in some components (needed for docs, not sure if flow needs it) -
theme
added to components wrapped inwithStyles
- casts inside
defaultProps
unexpectedly show in docs
From: https://github.com/callemall/material-ui/pull/9212#issuecomment-345435325
@rosskevin Some broken things I have noticed introduced with #8983. I don’t think that we should put flow interest on top of API ones. Way more people read the API documentation than uses flow.
- We mark properties required while they are not.
-| component | ElementType | 'div' | The component used for the root node. Either a string to use a DOM element or a component. |
+| <span style="color: #31a148">component *</span> | ElementType | 'div' | The component used for the root node. Either a string to use a DOM element or a component. |
- The
classes
property is missing in some components.
-| classes | Object | | Useful to extend the style applied to components. |
+| classes | Object | | |
- A
theme
property has been added to all the components.
+| theme | Object | | |
From: https://github.com/callemall/material-ui/pull/9203#issuecomment-345377494
A sample of the API diff it’s introducing:
| Name | Type | Default | Description |
|:-----|:-----|:--------|:------------|
| classes | Object | | Useful to extend the style applied to components. |
-| <span style="color: #31a148">component *</span> | ElementType | 'div' | The component used for the root node. Either a string to use a DOM element or a component. |
+| <span style="color: #31a148">component *</span> | ElementType | 'div': ElementType | The component used for the root node. Either a string to use a DOM element or a component. |
I’m wondering if we can avoid 'div': ElementType
. Any idea?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:11 (11 by maintainers)
Top Results From Across the Web
react-docgen issues related to flow upgrade #9222 - GitHub
A couple of issues found with recent flow changes, documented by @oliviertassinari and consolidated here. I'll be working these issues into ...
Read more >react-docgen - npm
A CLI and toolkit to extract information from React components for documentation generation.. Latest version: 5.4.3, last published: 6 ...
Read more >Creating a React Component Library With Typescript Using ...
How to build a reusable component library, publish and automate the release flow. One of the beauties of React is component reusability, which ......
Read more >A Guide For Migrating Your Project to TypeScript - Xiaoyun Yang
Introduction to TypeScript and guide for how to migrate your project from Flow to TypeScript. This post is a WIP.
Read more >6 Tools for Documenting Your React Components Like a Pro
Tools for documenting React UI components in 2019. Document components with Bit, StoryBook, StyleGuidist, Docz, MDX-docs, React docgen and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just submitted react-docgen PR https://github.com/reactjs/react-docgen/pull/231
It solves required/optional and flow type casts.
@rsolomon if you can PR the change to react-flow-types that would be most helpful. I’ve almost got all the docs changes here wrapped up. Still one bug on my docgen PR for a good pass on material-ui codebase.