FAQ | This is a LIVE service | Changelog

Skip to content

WIP: A quick demonstration of how we might generate a component's propTypes object.

Mike Bamford requested to merge spike-proptypes-generation into master

Not intended to be merged.

This MR uses: https://www.npmjs.com/package/typescript-proptypes-generator to generate a propTypes object from a component's property type. It can be run as follows:

./compose.sh proptype_generator up --build

Some notes:

  • If we chose this route then I would merge the output back into the *.tsx.
  • The library didn't recognise noUncheckedIndexedAccess so we would need to fork it.
  • Sidebar fails to generate (doesn't like SidebarStyleProps.classes)
  • Typography fails to generate (don't know why)

My feeling is that this isn't a well supported project (nor is the one it's forked from) and should probably be avoided. https://www.npmjs.com/package/babel-plugin-typescript-to-proptypes seems somewhat greener and could be a better choice (I had a go at using it but the babel config defeated me).

#31 (closed) & https://gitlab.developers.cam.ac.uk/uis/devops/digital-admissions/admissions-portal/ap-frontend/-/issues/59

Edited by Mike Bamford

Merge request reports