From e0e0a09c7c70ecd5fa0f2dde60cde3d333bd61e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jovan=20Kruni=C4=87?= Date: Fri, 4 Jan 2019 09:58:52 +0100 Subject: [PATCH] refactor: use enumeration for the type of an origin --- src/core/Thing.ts | 14 ++++++++++---- src/core/things/Favorite.ts | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/core/Thing.ts b/src/core/Thing.ts index 56353b8e..24d0b1e5 100644 --- a/src/core/Thing.ts +++ b/src/core/Thing.ts @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 StApps + * Copyright (C) 2018, 2019 StApps * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 3. @@ -96,7 +96,13 @@ export interface SCThing { url?: string; } -export type SCThingOriginType = 'remote' | 'user'; +/** + * Possible types of an origin + */ +export enum SCThingOriginType { + Remote = 'remote', + User = 'user', +} /** * Origin of a thing @@ -149,7 +155,7 @@ export interface SCThingRemoteOrigin extends SCThingOrigin { /** * Type of the origin */ - type: 'remote'; + type: SCThingOriginType.Remote; /** * Main URL of the origin @@ -174,7 +180,7 @@ export interface SCThingUserOrigin extends SCThingOrigin { /** * Type of the origin */ - type: 'user'; + type: SCThingOriginType.User; /** * When the saved thing was last updated with the latest state (e.g. from the backend) diff --git a/src/core/things/Favorite.ts b/src/core/things/Favorite.ts index 6ed75359..cac53680 100644 --- a/src/core/things/Favorite.ts +++ b/src/core/things/Favorite.ts @@ -41,6 +41,9 @@ export type SCFavoriteDataTypes = SCAcademicEventWithoutReferences * @validatable */ export interface SCFavorite extends SCSaveableThing { + /** + * Type of a favorite + */ type: SCThingType.Favorite; }