Page MenuHomePhabricator

[lib] Introduce `SelectedThreadColors` type
ClosedPublic

Authored by atul on Apr 8 2022, 1:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 5, 1:32 AM
Unknown Object (File)
Oct 4 2024, 11:07 AM
Unknown Object (File)
Sep 24 2024, 6:33 AM
Unknown Object (File)
Sep 24 2024, 6:33 AM
Unknown Object (File)
Sep 24 2024, 6:33 AM
Unknown Object (File)
Sep 15 2024, 12:32 AM
Unknown Object (File)
Sep 15 2024, 12:32 AM
Unknown Object (File)
Sep 15 2024, 12: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
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.