documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Does this support PropTypes via Flow?

Open ericclemmons opened this issue 7 years ago • 4 comments

I've been enjoying this project thus far, but a recent PR has introduced React.PropTypes via Flow.

A related project supports it, and I was trying to figure out if this one does or can:

https://github.com/reactjs/react-docgen#flow-type-support

Thanks!

ericclemmons avatar Nov 09 '16 14:11 ericclemmons

If you use flow to define the type of the props you should be fine.

Adding support for reacts old propTypez API sound useful too. Maybe you could take a stab at it?

arv avatar Nov 09 '16 15:11 arv

Going off of this example:

https://github.com/reactjs/react-docgen#example-1

import React, { Component } from 'react';

type Props = {
  /** Description of prop "foo". */
  primitive: number,
  /** Description of prop "bar". */
  literalsAndUnion: 'string' | 'otherstring' | number,
  arr: Array<any>,
  func?: (value: string) => void,
  obj?: { subvalue: ?boolean },
};

/**
 * General component description.
 */
export default class MyComponent extends Component<void, Props, void> {

  props: Props;

  render(): ?ReactElement {
    // ...
  }
}

documentation renders:

screen shot 2016-11-09 at 12 02 37 pm

How would you recommend this example be changed such that documentation provides much more standard, useful output as seen in your examples?

screen shot 2016-11-09 at 12 03 48 pm

Or would I want to run both of these projects together?

ericclemmons avatar Nov 09 '16 18:11 ericclemmons

Any update on this?? I need to group proptypes with component. How can I do that?

sashwini avatar Sep 24 '21 07:09 sashwini

what happens if you add the following:

@description - describes what it does

ondrovic avatar Oct 01 '21 18:10 ondrovic