Type action names (#1079)

* Type action names

* improve typing

Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
Faustino Kialungila 2020-03-25 14:13:59 +01:00 committed by GitHub
parent 9cc1037e7b
commit 4442addc02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 5 deletions

View file

@ -4,13 +4,14 @@ import {
ActionsManagerInterface,
UpdaterFn,
ActionFilterFn,
ActionName,
} from "./types";
import { ExcalidrawElement } from "../element/types";
import { AppState } from "../types";
import { t } from "../i18n";
export class ActionManager implements ActionsManagerInterface {
actions: { [keyProp: string]: Action } = {};
actions = {} as ActionsManagerInterface["actions"];
updater: UpdaterFn;
@ -77,7 +78,7 @@ export class ActionManager implements ActionsManagerInterface {
}));
}
renderAction = (name: string) => {
renderAction = (name: ActionName) => {
if (this.actions[name] && "PanelComponent" in this.actions[name]) {
const action = this.actions[name];
const PanelComponent = action.PanelComponent!;