aboutsummaryrefslogtreecommitdiffstats
path: root/packages/excalidraw/actions/register.ts
blob: 7c841e3aeee5ea2024c2f102a45039b65cfb3ef4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
import type { Action } from "./types";

export let actions: readonly Action[] = [];

export const register = <T extends Action>(action: T) => {
  actions = actions.concat(action);
  return action as T & {
    keyTest?: unknown extends T["keyTest"] ? never : T["keyTest"];
  };
};