Page MenuHomePhabricator

[lib] Introduce `SelectedThreadColors` type
ClosedPublic

Authored by atul on Apr 8 2022, 1:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Dec 6, 1:32 PM
Unknown Object (File)
Nov 14 2024, 8:58 AM
Unknown Object (File)
Nov 13 2024, 7:57 PM
Unknown Object (File)
Nov 13 2024, 7:55 PM
Unknown Object (File)
Nov 12 2024, 2:21 PM
Unknown Object (File)
Nov 10 2024, 10:03 AM
Unknown Object (File)
Nov 10 2024, 10:03 AM
Unknown Object (File)
Nov 10 2024, 10:03 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
Branch
april8 (branched from master)
Lint
No Lint Coverage
Unit
No Test Coverage

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.