Skip to Content
DocsReferenceHandlerspropTypeComposition

propTypeCompositionHandler

Adds the name of the module to the composes field when:

  • a variable is spread into propTypes
  • the import cannot be followed

Examples

When the propTypeCompositionHandler is active any of these components will result in the output below

component.tsx
import otherPropTypes from './Link.js'; import { Component } from 'react'; class Button extends Component { static propTypes = { ...otherPropTypes, }; render() { return <div />; } }
component.tsx
import otherPropTypes from './Link.js'; import { Component } from 'react'; class Button extends Component { render() { return <div />; } } Button.propTypes = { ...otherPropTypes, };
component.tsx
import otherPropTypes from './Link.js'; const Button = () => <div />; Button.propTypes = { ...otherPropTypes, };

Output

JSON
[ { "composes": ["./Link.js"] } ]
Last updated on