eui icon indicating copy to clipboard operation
eui copied to clipboard

[Docs] Default props that are renamed when being destructured do not appear on props tables

Open cee-chen opened this issue 2 years ago • 1 comments

Note: This applies to both EUI docs site's props tabs, and Storybook's controls pane.

Problem

Renaming props during their destructuring leads to either TS or React not correctly "seeing" and outputting their default values. Example of this:

https://github.com/elastic/eui/blob/3aea3111e16c148a6449ad988f611ad3304ec5c5/src/components/description_list/description_list.tsx#L33

Solution

  1. Update all instances across EUI of the above to not use variable renaming (example fix)
  2. Use @default jsdoc notation on the Typescript type to force showing a default value (slightly worse option as it's a bit less DRY and can fall out of date, but it may be a viable option for some scenarios)

cee-chen avatar Oct 19 '23 16:10 cee-chen

Two ways we could approach this...

  1. Fix the places where we rename variables
  2. Fix the underlying code / submit an issue to Storybook to fix it there as well

JasonStoltz avatar Oct 23 '23 16:10 JasonStoltz