WIP: A quick demonstration of how we might generate a component's propTypes object.
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 likeSidebarStyleProps.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