cisco-sbg-ui / magna-react

magna-react.vercel.app
5 stars 0 forks source link

Refactor and document polymorphic component props utils #856

Open mvelkCisco opened 2 months ago

mvelkCisco commented 2 months ago

These utilities could be cleaned up and documented better. Especially there's an edge case when passing a polymorphic component as a component prop of another polymorphic component basically disables the type checking silently.

Context and some initial refactoring in https://github.com/advthreat/incident-manager/pull/2870. Needs to be finished and moved here.

Consider adding type tests https://www.npmjs.com/package/@definitelytyped/dtslint

androche commented 2 months ago

Sharing the workaround PR for reference which includes having to keep a .js file around for the polymorphic so it can pick up propTypes: https://github.com/cisco-sbg-ui/magna-react/pull/857