diff --git a/apps/bmd/src/AppRoot.tsx b/apps/bmd/src/AppRoot.tsx index 279f5c83b..a935b5fa9 100644 --- a/apps/bmd/src/AppRoot.tsx +++ b/apps/bmd/src/AppRoot.tsx @@ -92,7 +92,7 @@ interface CardState { pauseProcessingUntilNoCardPresent: boolean showPostVotingInstructions?: PostVotingInstructions voterCardCreatedAt: number - tallyOnCard?: Optional + tallyOnCard?: PrecinctScannerCardTally } interface UserState { diff --git a/apps/bmd/src/pages/PollWorkerScreen.tsx b/apps/bmd/src/pages/PollWorkerScreen.tsx index 771039c10..2ff1444a7 100644 --- a/apps/bmd/src/pages/PollWorkerScreen.tsx +++ b/apps/bmd/src/pages/PollWorkerScreen.tsx @@ -1,12 +1,7 @@ import { DateTime } from 'luxon' import React, { useState, useEffect, useCallback } from 'react' -import { - ElectionDefinition, - Optional, - Tally, - VotingMethod, -} from '@votingworks/types' +import { ElectionDefinition, Tally, VotingMethod } from '@votingworks/types' import { Button, ButtonList, @@ -60,7 +55,7 @@ interface Props { machineConfig: MachineConfig printer: Printer togglePollsOpen: () => void - tallyOnCard: Optional + tallyOnCard?: PrecinctScannerCardTally clearTalliesOnCard: () => Promise } diff --git a/apps/bmd/src/utils/ScreenReader/AriaScreenReader.ts b/apps/bmd/src/utils/ScreenReader/AriaScreenReader.ts index 84b9b208c..3b46b9b84 100644 --- a/apps/bmd/src/utils/ScreenReader/AriaScreenReader.ts +++ b/apps/bmd/src/utils/ScreenReader/AriaScreenReader.ts @@ -146,9 +146,7 @@ export default class AriaScreenReader implements ScreenReader { : this.describeElement(node) } - private cleanDescription( - description: string | undefined - ): string | undefined { + private cleanDescription(description?: string): string | undefined { if (!description) { return } diff --git a/apps/bsd/src/AppRoot.tsx b/apps/bsd/src/AppRoot.tsx index c00121080..d53ea7311 100644 --- a/apps/bsd/src/AppRoot.tsx +++ b/apps/bsd/src/AppRoot.tsx @@ -123,7 +123,7 @@ const App = ({ card, hardware }: AppRootProps): JSX.Element => { setMarkThresholds(await config.getMarkThresholdOverrides()) }, []) - const updateElectionDefinition = async (e: Optional) => { + const updateElectionDefinition = async (e?: ElectionDefinition) => { setElectionDefinition(e) setElectionJustLoaded(true) } @@ -264,7 +264,7 @@ const App = ({ card, hardware }: AppRootProps): JSX.Element => { }, [history, isTestMode, refreshConfig]) const setMarkThresholdOverrides = useCallback( - async (markThresholdOverrides: Optional) => { + async (markThresholdOverrides?: MarkThresholds) => { await config.setMarkThresholdOverrides(markThresholdOverrides) await refreshConfig() history.replace('/') diff --git a/apps/bsd/src/screens/AdvancedOptionsScreen.tsx b/apps/bsd/src/screens/AdvancedOptionsScreen.tsx index d2c591341..8ae94f947 100644 --- a/apps/bsd/src/screens/AdvancedOptionsScreen.tsx +++ b/apps/bsd/src/screens/AdvancedOptionsScreen.tsx @@ -1,8 +1,4 @@ -import { - ElectionDefinition, - MarkThresholds, - Optional, -} from '@votingworks/types' +import { ElectionDefinition, MarkThresholds } from '@votingworks/types' import React, { useCallback, useEffect, useState, useContext } from 'react' import Button from '../components/Button' import LinkButton from '../components/LinkButton' @@ -23,10 +19,8 @@ interface Props { isTestMode: boolean isTogglingTestMode: boolean toggleTestMode: () => Promise - setMarkThresholdOverrides: ( - markThresholds: Optional - ) => Promise - markThresholds: Optional + setMarkThresholdOverrides: (markThresholds?: MarkThresholds) => Promise + markThresholds?: MarkThresholds electionDefinition: ElectionDefinition } diff --git a/apps/bsd/test/renderInAppContext.tsx b/apps/bsd/test/renderInAppContext.tsx index b73743279..98a524af5 100644 --- a/apps/bsd/test/renderInAppContext.tsx +++ b/apps/bsd/test/renderInAppContext.tsx @@ -8,7 +8,7 @@ import { Router } from 'react-router-dom' import AppContext from '../src/contexts/AppContext' interface RenderInAppContextParams { - route?: string | undefined + route?: string history?: MemoryHistory // eslint-disable-line @typescript-eslint/no-explicit-any electionDefinition?: ElectionDefinition machineId?: string diff --git a/apps/election-manager/src/contexts/AppContext.ts b/apps/election-manager/src/contexts/AppContext.ts index 476e733e8..61050da93 100644 --- a/apps/election-manager/src/contexts/AppContext.ts +++ b/apps/election-manager/src/contexts/AppContext.ts @@ -3,7 +3,6 @@ import { ElectionDefinition, FullElectionTally, FullElectionExternalTally, - Optional, UserSession, } from '@votingworks/types' import { usbstick, NullPrinter, Printer } from '@votingworks/utils' @@ -48,7 +47,7 @@ export interface AppContextInterface { ) => Promise setIsTabulationRunning: React.Dispatch> generateExportableTallies: () => ExportableTallies - currentUserSession: Optional + currentUserSession?: UserSession attemptToAuthenticateAdminUser: (passcode: string) => boolean lockMachine: () => void machineConfig: MachineConfig diff --git a/apps/election-manager/src/screens/DefinitionContestsScreen.tsx b/apps/election-manager/src/screens/DefinitionContestsScreen.tsx index da67323cd..af4a8331c 100644 --- a/apps/election-manager/src/screens/DefinitionContestsScreen.tsx +++ b/apps/election-manager/src/screens/DefinitionContestsScreen.tsx @@ -89,7 +89,7 @@ const TextField = ({ pattern?: string step?: number type?: 'text' | 'textarea' | 'number' - value: string | number | undefined + value?: string | number }) => (