From 89f3579ca9009f793742170928d808ab4c35d931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Minelli?= <michael@minelli.me> Date: Thu, 18 Jan 2024 13:20:59 +0100 Subject: [PATCH] ExerciseResultsFile => Store icon property with identifier and not value --- types/Dojo/ExerciseResultsFile.ts | 2 +- types/Icon.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/Dojo/ExerciseResultsFile.ts b/types/Dojo/ExerciseResultsFile.ts index 9f70eff..135a532 100644 --- a/types/Dojo/ExerciseResultsFile.ts +++ b/types/Dojo/ExerciseResultsFile.ts @@ -16,7 +16,7 @@ const ExerciseResultsFile = z.object({ otherInformations: z.array(z.object({ name : z.string(), description : z.string().optional(), - icon : z.enum(Object.keys(Icon) as [ firstKey: string, ...otherKeys: Array<string> ]).optional().transform(value => value ? (Icon as { [index: string]: string })[value] : undefined), + icon : z.enum(Object.keys(Icon) as [ firstKey: string, ...otherKeys: Array<string> ]).optional(), itemsOrInformations: z.union([ z.array(z.string()), z.string() ]) })) .optional() diff --git a/types/Icon.ts b/types/Icon.ts index 81f0384..33ee072 100644 --- a/types/Icon.ts +++ b/types/Icon.ts @@ -10,7 +10,7 @@ const Icon = { NULL : '', NONE : '', BADMINTON: '🏸' -} as const; +} as { [index: string]: string }; export default Icon; \ No newline at end of file -- GitLab