refactor: extract inline type definitions

This commit is contained in:
Michel Jonathan Schmitz
2019-02-07 10:56:18 +01:00
parent 06f8e1f436
commit 01a1d40f11
13 changed files with 335 additions and 122 deletions

View File

@@ -22,6 +22,7 @@ import {
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCMap} from '../types/Map';
/**
* Categories of a room
@@ -53,7 +54,7 @@ export interface SCRoomWithoutReferences
/**
* The inventory of the place/room as a list of items and their quantity.
*/
inventory?: Array<{ key: string, value: number }>;
inventory?: SCMap<number>;
/**
* Translations of specific values of the object

View File

@@ -97,11 +97,7 @@ export interface SCTourStepTooltip {
/**
* How the step shall be resolved
*/
resolved?: { element: string } | { event: string } | { location: { is: string } | { match: string } } | {
menu:
'open-left'
| 'open-right';
};
resolved?: SCTourResolvedElement | SCTourResolvedEvent | SCTourResolvedLocation | SCTourResolvedMenu;
/**
* Text that the tooltip shall contain
@@ -138,3 +134,63 @@ export interface SCTourStepMenu {
*/
type: 'menu';
}
/**
* Tour step resolved by an element
*/
export interface SCTourResolvedElement {
/**
* Element name
*/
element: string;
}
/**
* Tour step resolved by an event
*/
export interface SCTourResolvedEvent {
/**
* Event name
*/
event: string;
}
/**
* Tour step resolved by a location
*/
export interface SCTourResolvedLocation {
/**
* Matching location
*/
location: SCTourResolvedLocationTypeIs | SCTourResolvedLocationTypeMatch;
}
/**
* Tour step resolved by a location for a specific location
*/
export interface SCTourResolvedLocationTypeIs {
/**
* Specific location name
*/
is: string;
}
/**
* Tour step resolved by a location for a specific location
*/
export interface SCTourResolvedLocationTypeMatch {
/**
* Regex location name
*/
match: string;
}
/**
* Tour step resolved by interacting with a menu
*/
export interface SCTourResolvedMenu {
/**
* Menu location
*/
menu: 'open-left' | 'open-right';
}