Skip to content

react-docgen is not compatible with react-like libraries #96

Open
@Chaptykov

Description

@Chaptykov

There are some react-like libraries such as react-lite, preact-compat and other which use API of React for components including PropTypes. All react-docgen methods work well with these libraries. But [this module](react-docgen disables work with react-like libraries) disallows using it.

I have a preact-compat component:

import { h, Component, PropTypes } from 'preact-compat';

export default class MyComponent extends Component {
  render() {
    return <div>{this.props.children}</div>;
  }
}

MyComponent.propTypes = {
  myProp: PropTypes.func
};

Actual react-docgen returns this value for type of myProp:

{
  name: 'custom',
  raw: 'PropTypes.func'
}

If I add preact-compat to whitelist react-docgen returns expected result:

{
  type: 'func'
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions