Skip to content

Commit

Permalink
Update MeasurementsDisplay and QueryBoolean types to be more readable
Browse files Browse the repository at this point in the history
Specifying the values again make them more readable as suggested
in review

<#1910 (comment)>
  • Loading branch information
joverlee521 committed Dec 7, 2024
1 parent ec8a313 commit 49ee53c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actions/measurements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/reducers/measurements/types.ts
Original file line number Diff line number Diff line change
@@ -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 -- //
Expand Down

0 comments on commit 49ee53c

Please sign in to comment.