From 746c3a23326d012b0c874b992d54edc586905f57 Mon Sep 17 00:00:00 2001 From: Johannes Klein Agents Date: Fri, 27 Nov 2026 14:34:07 +0100 Subject: [PATCH] Turn on strictFunctionTypes OptionSelect is generic over its value type, and every prop type that embeds it names the real type. Handlers registered with ipcMain.handle take IpcMainInvokeEvent. The unhandled-error bridge event has a typed payload. Option gains an Input type parameter so part start and end accept the text OptionTextField hands them. Closes #407 Co-Authored-By: Claude Opus 5.5 --- src/app/AlignmentCard.tsx | 10 +++++----- src/app/Model.tsx | 24 ++++++++++++------------ src/app/PartitionEditor.tsx | 6 +++--- src/app/Raxml.tsx | 4 ++-- src/app/components/OptionSelect.tsx | 21 +++++++++++---------- src/app/store/Option.ts | 9 +++++---- src/app/store/Part.test.ts | 4 ++-- src/app/store/PartOptions.ts | 7 ++++--- src/app/store/RunList.ts | 4 ++-- src/app/unhandledError.test.tsx | 3 ++- src/common/rendererBridge.ts | 8 +++++++- src/main/api.ts | 3 ++- src/main/astral.ts | 4 ++-- src/main/modelSelection.test.ts | 4 ++-- src/main/modelSelection.ts | 4 ++-- src/main/processHelpers.test.ts | 4 ++-- src/main/processHelpers.ts | 6 +++--- src/main/startRun.ts | 4 ++-- src/preload/index.ts | 4 ++-- tsconfig.json | 1 + 20 files changed, 73 insertions(+), 61 deletions(-) diff --git a/src/app/AlignmentCard.tsx b/src/app/AlignmentCard.tsx index 9a408704..f2aa8cb6 100644 --- a/src/app/AlignmentCard.tsx +++ b/src/app/AlignmentCard.tsx @@ -44,12 +44,12 @@ interface CardAlignment { loading: boolean; showPartition: boolean; partition: { isComplete: boolean }; - substitutionModel: OptionSelectOptionLike; + substitutionModel: OptionSelectOptionLike; multistateNumber: OptionTextFieldOptionLike; - ngStationaryFrequencies: OptionSelectOptionLike; - ngInvariantSites: OptionSelectOptionLike; - ngRateHeterogeneity: OptionSelectOptionLike; - ngAscertainmentBias: OptionSelectOptionLike; + ngStationaryFrequencies: OptionSelectOptionLike; + ngInvariantSites: OptionSelectOptionLike; + ngRateHeterogeneity: OptionSelectOptionLike; + ngAscertainmentBias: OptionSelectOptionLike; modelExtra: CardModelExtra | null; modelTestCanRun: boolean; modeltestLoading: boolean; diff --git a/src/app/Model.tsx b/src/app/Model.tsx index 1c8c7394..b31f2487 100644 --- a/src/app/Model.tsx +++ b/src/app/Model.tsx @@ -11,25 +11,25 @@ import type { OptionCheckOptionLike } from './components/OptionCheck'; interface ModelRun { usesModeltestNg: boolean; usesAstral: boolean; - analysis: OptionSelectOptionLike; - numRuns: OptionSelectOptionLike; - numRepetitions: OptionSelectOptionLike; - numRepetitionsNg: OptionSelectOptionLike; + analysis: OptionSelectOptionLike; + numRuns: OptionSelectOptionLike; + numRepetitions: OptionSelectOptionLike; + numRepetitionsNg: OptionSelectOptionLike; branchLength: OptionCheckOptionLike; sHlike: OptionCheckOptionLike; combinedOutput: OptionCheckOptionLike; - startingTree: OptionSelectOptionLike; - outGroup: OptionSelectOptionLike; + startingTree: OptionSelectOptionLike; + outGroup: OptionSelectOptionLike; haveRandomSeed: boolean; randomSeed: number; setRandomSeed: ( value: string ) => void; - substitutionMatrix: OptionSelectOptionLike; - substitutionRate: OptionSelectOptionLike; - substitutionI: OptionSelectOptionLike; - substitutionAscertainment: OptionSelectOptionLike; - multistateModel: OptionSelectOptionLike; + substitutionMatrix: OptionSelectOptionLike; + substitutionRate: OptionSelectOptionLike; + substitutionI: OptionSelectOptionLike; + substitutionAscertainment: OptionSelectOptionLike; + multistateModel: OptionSelectOptionLike; estimatedFrequencies: OptionCheckOptionLike; - baseFrequencies: OptionSelectOptionLike; + baseFrequencies: OptionSelectOptionLike; } export interface ModelProps { diff --git a/src/app/PartitionEditor.tsx b/src/app/PartitionEditor.tsx index 9972e8be..83ace638 100644 --- a/src/app/PartitionEditor.tsx +++ b/src/app/PartitionEditor.tsx @@ -21,12 +21,12 @@ interface PartPositionOption extends Omit interface EditorPartition { partToAdd: { - type: OptionSelectOptionLike; - aaType: OptionSelectOptionLike; + type: OptionSelectOptionLike; + aaType: OptionSelectOptionLike; name: OptionTextFieldOptionLike; start: PartPositionOption; end: PartPositionOption; - codon: OptionSelectOptionLike; + codon: OptionSelectOptionLike; }; progress: number; currentEndValue: number; diff --git a/src/app/Raxml.tsx b/src/app/Raxml.tsx index cc2a4682..17453924 100644 --- a/src/app/Raxml.tsx +++ b/src/app/Raxml.tsx @@ -12,8 +12,8 @@ import { FormHelperText } from '@mui/material'; interface RaxmlRun { command: string; - binary: OptionSelectOptionLike; - numThreads: OptionSelectOptionLike; + binary: OptionSelectOptionLike; + numThreads: OptionSelectOptionLike; modelTestIsRunningOnAlignment: boolean; cancelModeltestOnAlignment: () => void; running: boolean; diff --git a/src/app/components/OptionSelect.tsx b/src/app/components/OptionSelect.tsx index 71fd069f..2b4235ee 100644 --- a/src/app/components/OptionSelect.tsx +++ b/src/app/components/OptionSelect.tsx @@ -11,27 +11,27 @@ export interface OptionSelectChoice { title: string | number; } -export interface OptionSelectOptionLike { +export interface OptionSelectOptionLike { notAvailable?: boolean; title: string; hoverInfo: string; options: readonly OptionSelectChoice[]; - value: string | number | readonly string[]; - setValue: ( value: unknown ) => void; + value: Value; + setValue: ( value: Value ) => void; multiple?: boolean; error: unknown; placeholder?: string; } -export interface OptionSelectProps { - option: OptionSelectOptionLike; +export interface OptionSelectProps { + option: OptionSelectOptionLike; sx?: SxProps; } -const OptionSelect = observer( function OptionSelect( { +function OptionSelect( { option, sx, -}: OptionSelectProps ) { +}: OptionSelectProps ) { if ( option.notAvailable || option.options.length === 0 ) { return null; } @@ -59,7 +59,8 @@ const OptionSelect = observer( function OptionSelect( {