Page MenuHomePhabricator

[lib] Introduce `SelectedThreadColors` type
ClosedPublic

Authored by atul on Apr 8 2022, 1:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 19, 7:11 PM
Unknown Object (File)
Thu, Dec 19, 2:32 PM
Unknown Object (File)
Wed, Dec 18, 4:36 PM
Unknown Object (File)
Wed, Dec 18, 4:18 PM
Unknown Object (File)
Wed, Dec 18, 4:00 PM
Unknown Object (File)
Wed, Dec 18, 1:17 PM
Unknown Object (File)
Fri, Dec 6, 1:32 PM
Unknown Object (File)
Nov 14 2024, 8:58 AM

Details

Summary

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.

Test Plan

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

atul requested review of this revision.Apr 8 2022, 1:39 PM
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

This revision is now accepted and ready to land.Apr 10 2022, 7:27 PM
This revision was automatically updated to reflect the committed changes.