2

is there a way to document with TSDoc rest parameters or parameters that going to be destructured inside a function?, a pattern that is used for example in react, where params it be destructured inside the function(Component). Something similar to this in JSDoc.

// for now what I am doing is documenting each of the types which are going to compose the `object` param.
export type Props = {
  /** My documentation */
  component?: <sometype>;
  /** My documentation */
  fallback?: <sometype>;
};

export default function MyFun(props: Props): <Type> {
  const { property1, property2, ...rest_of_properties } = props;

  // aditional logic
}
Cristian Flórez
  • 2,277
  • 5
  • 29
  • 51

0 Answers0