nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
292 stars 162 forks source link

Decide best practices for typing React props #1723

Open victorlin opened 10 months ago

victorlin commented 10 months ago

With the adoption of TypeScript, there should be a standard way of typing props. This was explored in #1704 and we came up with these options:

  1. Define each set of props independently without importing other prop types. This is the simplest approach but results in much code duplication when it comes to prop drilling, especially when each prop has a descriptive docstring.
  2. Export individual prop types that are used by a parent. This is what was done in #1704.
  3. Export all props under one type if any are used by a parent. This was considered and evaluated in https://github.com/nextstrain/auspice/pull/1704#discussion_r1387354111.
victorlin commented 10 months ago

I think (2) is just fine for now, but we might want to keep the door open to other options with increased TypeScript adoption.