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

ref and key are not omitted from Props-generated table #921

Closed
disintegrator opened this issue Jun 17, 2019 · 2 comments
Closed

ref and key are not omitted from Props-generated table #921

disintegrator opened this issue Jun 17, 2019 · 2 comments

Comments

@disintegrator
Copy link

Bug Report

Describe the bug

Props component includes ref and key props in props table when passed a component created with React.forwardRef. I would argue these props should not be exposed because they cannot be documented in our code. They are also part of React's API in that they are documented elsewhere and considered assumed knowledge in our docs.

To Reproduce

Create this component

// docs/Faulty.tsx

import React from "react";

export interface FaultyProps {}

const Faulty = React.forwardRef<HTMLDivElement>((props, ref) => {
  return <div ref={ref}>{props.children}</div>;
});

export default Faulty;

With this documentation

{/* docs/Faulty.mdx */}

import { Props } from "docz";
import Faulty from "./Faulty";

# Faulty

<Props of={Faulty} />

Expected behavior

ref and key are omitted from generated props table

Environment

  • OS: macOS 10.14.5
  • Node version: 10.15.3
  • Yarn version: 1.16.0
  • Docz packages:
{
  "docz": "1.2.0",
  "docz-theme-default": "1.2.0"
}

Additional context/Screenshots

image

@disintegrator
Copy link
Author

For what it's worth, I tried passing custom docgenConfig but since it propFilter must be a function, it is not parsed correctly by load-cfg.

@ejuo
Copy link
Contributor

ejuo commented Jun 17, 2019

I encountered a similar problem. Moreover, earlier on the same version of docz it was OK, perhaps this is due to the update of third libraries.
The problem is that when calling props.parent (styleguidist/react-docgen-typescript#151), it is always null. And therefore all properties fall into the props table.
UPD: it's breaking for typescript version > 3.5.

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

No branches or pull requests

3 participants