Interface ICommand<Model, Real, RunResult, CheckAsync>

Interface that should be implemented in order to define a command

Since 1.5.0

interface ICommand<Model, Real, RunResult, CheckAsync> {
    check(m: Readonly<Model>): CheckAsync extends false
        ? boolean
        : Promise<boolean>;
    run(m: Model, r: Real): RunResult;
    toString(): string;
}

Type Parameters

  • Model extends object
  • Real
  • RunResult
  • CheckAsync extends boolean = false

Hierarchy (view full)

Methods

  • Check if the model is in the right state to apply the command

    WARNING: does not change the model

    Parameters

    • m: Readonly<Model>

      Model, simplified or schematic representation of real system

    Returns CheckAsync extends false
        ? boolean
        : Promise<boolean>

    Since 1.5.0