From 0737b8efdbe8e23cb3cd3865b9eb9e61ed8e54bd Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Fri, 18 Nov 2022 12:58:40 +0100 Subject: [PATCH] fix: Palette name types --- app/configurator/config-types.ts | 5 ++++- app/palettes.ts | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/configurator/config-types.ts b/app/configurator/config-types.ts index e464a2af7..b819fe474 100644 --- a/app/configurator/config-types.ts +++ b/app/configurator/config-types.ts @@ -319,9 +319,12 @@ export type PieConfig = t.TypeOf; const DivergingPaletteType = t.union([ t.literal("BrBG"), - t.literal("PRGn"), t.literal("PiYG"), + t.literal("PRGn"), t.literal("PuOr"), + t.literal("RdBu"), + t.literal("RdYlBu"), + t.literal("RdYlGn"), ]); export type DivergingPaletteType = t.TypeOf; diff --git a/app/palettes.ts b/app/palettes.ts index 6963b4705..8459222cd 100644 --- a/app/palettes.ts +++ b/app/palettes.ts @@ -165,7 +165,7 @@ type SteppedPalette = Omit, "interpolator"> & { colors: ReadonlyArray; }; const steppedPaletteSteps = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]; -const divergingPaletteKeys = [ +const divergingPaletteKeys: DivergingPaletteType[] = [ "RdBu", "RdYlBu", "RdYlGn", @@ -173,15 +173,15 @@ const divergingPaletteKeys = [ "PRGn", "PiYG", "PuOr", -] as DivergingPaletteType[]; -const sequentialPaletteKeys = [ +]; +const sequentialPaletteKeys: SequentialPaletteType[] = [ "blues", "greens", "greys", "oranges", "purples", "reds", -] as SequentialPaletteType[]; +]; const interpolatorByName = { RdBu: interpolateRdBu, RdYlBu: interpolateRdYlBu,