Page MenuHomePhabricator

[lib] Introduce `SelectedThreadColors` type
ClosedPublic

Authored by atul on Apr 8 2022, 1:34 PM.
Tags
None
Referenced Files
F3233010: D3679.diff
Tue, Nov 12, 2:21 PM
Unknown Object (File)
Sun, Nov 10, 10:03 AM
Unknown Object (File)
Sun, Nov 10, 10:03 AM
Unknown Object (File)
Sun, Nov 10, 10:03 AM
Unknown Object (File)
Sun, Nov 10, 10:03 AM
Unknown Object (File)
Sun, Nov 10, 10:03 AM
Unknown Object (File)
Sun, Nov 10, 5:58 AM
Unknown Object (File)
Tue, Nov 5, 1:32 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
landapril11 (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.