Typescript

This commit is contained in:
Mitchell McCaffrey
2021-07-17 12:48:04 +10:00
parent e48d19a817
commit fecf8090ea
23 changed files with 556 additions and 254 deletions

View File

@@ -1,7 +1,11 @@
import React from "react";
import Action from "../actions/Action";
import { Drawing } from "./Drawing";
import { Fog } from "./Fog";
import { Grid } from "./Grid";
export type MapToolId =
| "map"
| "move"
| "fog"
| "drawing"
@@ -42,12 +46,30 @@ export type FileMapResolutions = {
ultra?: string;
};
export type MapQuality = keyof FileMapResolutions | "original";
export type FileMap = BaseMap & {
type: "file";
file: string;
resolutions: FileMapResolutions;
thumbnail: string;
quality: keyof FileMapResolutions | "original";
quality: MapQuality;
};
export type Map = DefaultMap | FileMap;
export type MapActions = {
mapDrawActions: Action<Drawing>[];
mapDrawActionIndex: number;
fogDrawActions: Action<Fog>[];
fogDrawActionIndex: number;
};
export type MapActionsKey = keyof Pick<
MapActions,
"mapDrawActions" | "fogDrawActions"
>;
export type MapActionsIndexKey = keyof Pick<
MapActions,
"mapDrawActionIndex" | "fogDrawActionIndex"
>;