diff --git a/apps/mark-scan/backend/src/custom-paper-handler/state_machine.ts b/apps/mark-scan/backend/src/custom-paper-handler/state_machine.ts index 56e706eb0c..2655a9443b 100644 --- a/apps/mark-scan/backend/src/custom-paper-handler/state_machine.ts +++ b/apps/mark-scan/backend/src/custom-paper-handler/state_machine.ts @@ -376,13 +376,8 @@ export function buildMachine( { id: 'printBallot', src: (context, event) => { - // Need to hint to Typescript that we want the 'VOTER_INITIATED_PRINT' event in our union type of events - if ('pdfData' in event) { - return driverPrintBallot(context.driver, event.pdfData, {}); - } - throw new Error( - `printing_ballot entry called by unsupported event type: ${event.type}` - ); + assert(event.type === 'VOTER_INITIATED_PRINT'); + return driverPrintBallot(context.driver, event.pdfData, {}); }, onDone: { target: 'scanning',