From 49ee53c426408a85c20862ba16bdb4304b552e97 Mon Sep 17 00:00:00 2001 From: Jover Lee Date: Fri, 22 Nov 2024 11:48:28 -0800 Subject: [PATCH] Update MeasurementsDisplay and QueryBoolean types to be more readable Specifying the values again make them more readable as suggested in review --- src/actions/measurements.ts | 4 ++-- src/reducers/measurements/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/actions/measurements.ts b/src/actions/measurements.ts index e395b1486..a996f84f6 100644 --- a/src/actions/measurements.ts +++ b/src/actions/measurements.ts @@ -37,8 +37,8 @@ interface GroupingValues { const filterQueryPrefix = "mf_"; type MeasurementsFilterQuery = `mf_${string}` -const queryBooleanValues = ["show", "hide"] as const; -type QueryBoolean = (typeof queryBooleanValues)[number] +type QueryBoolean = "show" | "hide" +const queryBooleanValues: QueryBoolean[] = ["show", "hide"]; export const isQueryBoolean = (x: any): x is QueryBoolean => queryBooleanValues.includes(x) /* Measurements query parameters that are constructed and/or parsed here. */ interface MeasurementsQuery { diff --git a/src/reducers/measurements/types.ts b/src/reducers/measurements/types.ts index 9c882ec76..2363ff202 100644 --- a/src/reducers/measurements/types.ts +++ b/src/reducers/measurements/types.ts @@ -1,8 +1,8 @@ import { measurementIdSymbol } from "../../util/globals"; // -- Shared Measurements types -- // -export const measurementsDisplayValues = ["raw", "mean"]; -export type MeasurementsDisplay = (typeof measurementsDisplayValues)[number] +export type MeasurementsDisplay = "raw" | "mean" +export const measurementsDisplayValues: MeasurementsDisplay[] = ["raw", "mean"]; export const isMeasurementsDisplay = (x: any): x is MeasurementsDisplay => measurementsDisplayValues.includes(x); // -- Measurements JSON types -- //