extract-react-types
extract-react-types copied to clipboard
One stop shop for documenting your react components.
Seems to work fairly well. Shifted a bit from the original idea. Needs a little bit of thought about wrappers. E.g. the table layout now requires the user to provide...
When we want to display a type that is not a prop type we do a hack like this. ``` import { AttributesType } from '../src/types'; export default function Attributes(props:...
💡 Example use case: ```js interface CustomComponentType { (props: ComponentProps): JSX.Element : null; } const Component = forwardRef(() => {}); export default memo(Component) as CustomComponentType; ```
🤩 Currently type inference works for the following cases: ```js memo((props: ComponentProps) => {}); memo(forwardRef(() => {})); const Component = forwardRef(() => {}); memo(Component); ``` 🤯 It would be cool...
Right now there is no official way to hide props from the docs. Probably we can use something like `@internal` or `@private` to hide them. ```ts export interface Props {...
The way ERT evaluates complex types and language specific features is largely a manual process. We have to manually tell ERT how to interpret things like `extends` and `React.FC`, so...
This is a common issue with extract-react-types (ERT), which essentially means that: **You are using a language feature that ERT is not familiar with** > The way ERT evaluates complex...
The default value for props does not always seem to get extracted by `extract-react-types`. One place where this is very visible is https://atlassian.design/components/button/code which has no default value information (despite...
In some cases where a component's props are obscured by higher order components we should to define an override so that ERT can still access the relevant props of the...
I am using XOR type from here: https://bitbucket.org/atlassian/atlaskit-mk-2/src/31638e072721303cafbea43fe78c94a1ef92fd11/packages/core/type-helpers/src/index.ts#lines-159 To specify a type that is one or another, but not both here: https://bitbucket.org/atlassian/atlaskit-mk-2/pull-requests/6112/ms-1987-step-31-move-editor-and-other/diff#Lpackages/editor/editor-core/src/plugins/media/types.tsT79 Basically, I want this prop to accept either...