diff --git a/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts b/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts index c1230aaf33..77bfe82bc3 100644 --- a/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts +++ b/packages/cursorless-engine/src/core/commandRunner/CommandRunnerImpl.ts @@ -211,6 +211,13 @@ export class CommandRunnerImpl implements CommandRunner { default: { const action = this.actions[actionDescriptor.name]; + + // Ensure we don't miss any new actions. Needed because we don't have input validation. + // FIXME: remove once we have schema validation (#983) + if (action == null) { + throw new Error(`Unknown action: ${actionDescriptor.name}`); + } + this.finalStages = action.getFinalStages?.() ?? []; this.noAutomaticTokenExpansion = action.noAutomaticTokenExpansion ?? false; diff --git a/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts index 97b884dea0..b88b030393 100644 --- a/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/MarkStageFactoryImpl.ts @@ -47,6 +47,13 @@ export class MarkStageFactoryImpl implements MarkStageFactory { return new TargetMarkStage(this.targetPipelineRunner, mark); case "explicit": return new ExplicitMarkStage(mark); + default: { + // Ensure we don't miss any new marks. Needed because we don't have input validation. + // FIXME: remove once we have schema validation (#983) + const _exhaustiveCheck: never = mark; + const { type } = mark; + throw new Error(`Unknown mark: ${type}`); + } } } } diff --git a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts index 5f7b6ec009..e414e99d1c 100644 --- a/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts +++ b/packages/cursorless-engine/src/processTargets/ModifierStageFactoryImpl.ts @@ -109,6 +109,13 @@ export class ModifierStageFactoryImpl implements ModifierStageFactory { throw Error( `Unexpected modifier '${modifier.type}'; it should have been removed during inference`, ); + default: { + // Ensure we don't miss any new modifiers. Needed because we don't have input validation. + // FIXME: remove once we have schema validation (#983) + const _exhaustiveCheck: never = modifier; + const { type } = modifier; + throw new Error(`Unknown modifier: ${type}`); + } } }