Not sure I'm doing this right... but wanted to create a Flow type that was basically a union of the strings in selectedThreadColors without writing everything out twice.
Details
Details
Also introduced type to ColorSelector and it worked as expected.
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/shared/thread-utils.js | ||
---|---|---|
85–97 ↗ | (On Diff #11259) | alternatively could do something like const selectedThreadColorsObj = { 'B8753D': 1, 'C85000': 2, 'AA4B4B': 3, '4B87AA': 4, '648CAA': 5, '57697F': 6, '6D49AB': 7, '00A591': 8, '008F83': 9, '575757': 10, }; const selectedThreadColors: $ReadOnlyArray<string> = Object.keys(selectedThreadColorsObj); export type SelectedThreadColors = $Keys<typeof selectedThreadColorsObj>; and avoid the potentialColors stuff below. |
85–97 ↗ | (On Diff #11259) | yeah I'll just do that and update this diff |