From e920a162f8ec8da1f8624dba82f4e75cee8cdd28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Mon, 6 Dec 2021 15:05:23 +0100 Subject: [PATCH] Add TS interface for location on Shop module --- src/components/organisms/Shop.svelte | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/components/organisms/Shop.svelte b/src/components/organisms/Shop.svelte index b8cef0e..4720df0 100644 --- a/src/components/organisms/Shop.svelte +++ b/src/components/organisms/Shop.svelte @@ -4,15 +4,20 @@ import Button from '$components/atoms/Button.svelte' import Image from '$components/atoms/Image.svelte' - const { locations, shop } = getContext('global') + interface Location { + slug: string + name: string + has_poster: boolean + } + const { locations, shop } = getContext('global') const locationsWithPoster = locations // Filter locations with posters only - .filter((loc: any) => loc.has_poster) + .filter((loc: Location) => loc.has_poster) // Sort locations alphabetically from slug (a>z) - .sort((a: any, b: any) => a.slug.localeCompare(b.slug)) + .sort((a: Location, b: Location) => a.slug.localeCompare(b.slug)) // Return name only - .map((loc: any) => loc.name) + .map((loc: Location) => loc.name)