diff --git a/src/app/AlignmentCard.tsx b/src/app/AlignmentCard.tsx index 9a408704..3cad9542 100644 --- a/src/app/AlignmentCard.tsx +++ b/src/app/AlignmentCard.tsx @@ -29,7 +29,7 @@ interface CardModelExtra { value: string; onChange: ( value: string ) => void; notAvailable: boolean; - hoverInfo: string; + hoverInfo?: string; error: unknown; } @@ -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/Input.tsx b/src/app/Input.tsx index 233eb792..fa5161de 100644 --- a/src/app/Input.tsx +++ b/src/app/Input.tsx @@ -33,7 +33,7 @@ type InputRun = PartitionFileCardProps['run'] & { inputIsAlignment: boolean; alignments: ( AlignmentCardProps['alignment'] & { path: string } )[]; inputIsTree: boolean; - astralTree: AstralTreeCardProps['astralTree']; + astralTree: AstralTreeCardProps['astralTree'] | null | undefined; canLoadAlignment: boolean; haveAlignments: boolean; canLoadPartitionFile: boolean; @@ -60,7 +60,7 @@ function droppedPath( file: File ): string { } const Input = ( { run }: InputProps ): React.JSX.Element => { - // run.hasAstralTree is the condition on which to show an astral tree card + // run.astralTree (hasAstralTree) is the condition on which to show an astral tree card // For some reason when changed in the mobx store a rerender is not triggered with this boolean with the conditional below alone // With this if the component rerenders as should be if ( run.hasAstralTree ) { @@ -143,7 +143,7 @@ const Input = ( { run }: InputProps ): React.JSX.Element => { /> ) ) : null} - {run.inputIsTree && run.hasAstralTree + {run.inputIsTree && run.astralTree ? ( ) 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/bootstrap.ts b/src/app/bootstrap.ts index e6ed79b2..4cbe2737 100644 --- a/src/app/bootstrap.ts +++ b/src/app/bootstrap.ts @@ -50,7 +50,7 @@ function initDev( exampleFiles: ExampleFilesPayload ): void { ].map( ( filename ) => ( { path: join( exampleFilesDir, 'phylip', filename ), } ) ); - const useFiles = [].concat( useFastaFiles, usePhylipFiles ); + const useFiles = [ ...useFastaFiles, ...usePhylipFiles ]; store.activeRun.addAlignments( useFiles ); store.activeRun.setOutputDir( exampleFiles.outdir ); setTimeout( () => { diff --git a/src/app/components/ErrorDialog.test.tsx b/src/app/components/ErrorDialog.test.tsx index 01616ab0..f7e55493 100644 --- a/src/app/components/ErrorDialog.test.tsx +++ b/src/app/components/ErrorDialog.test.tsx @@ -24,7 +24,7 @@ it( 'the reload action reloads the window', () => { } ); const button = Array.from( document.body.querySelectorAll( 'button' ) ) - .find( ( item ) => item.textContent === 'Ignore and reload' ); + .find( ( item ) => item.textContent === 'Ignore and reload' )!; act( () => { button.click(); } ); @@ -55,7 +55,7 @@ function renderDialog( error: Error ) { div, button( label: string ) { return Array.from( document.body.querySelectorAll( 'button, a' ) ) - .find( ( item ) => item.textContent === label ); + .find( ( item ) => item.textContent === label )!; }, }; } @@ -94,7 +94,7 @@ Locale: en-US`; const url = new URL( openExternal.mock.calls[0][0] ); expect( `${url.origin}${url.pathname}` ).toBe( 'https://github.com/AntonelliLab/raxmlGUI/issues/new' ); expect( url.searchParams.get( 'title' ) ).toBe( 'Error: boom' ); - const body = url.searchParams.get( 'body' ); + const body = url.searchParams.get( 'body' )!; expect( body.startsWith( 'Autogenerated report:' ) ).toBe( true ); expect( body ).toContain( 'boom' ); expect( body ).toContain( 'raxml -s primates.fasta' ); diff --git a/src/app/components/OptionCheck.tsx b/src/app/components/OptionCheck.tsx index 906b5719..4da4e0af 100644 --- a/src/app/components/OptionCheck.tsx +++ b/src/app/components/OptionCheck.tsx @@ -9,7 +9,7 @@ export interface OptionCheckOptionLike { value: boolean; setValue: ( value: boolean ) => void; notAvailable: boolean; - hoverInfo: string; + hoverInfo?: string; } export interface OptionCheckProps { diff --git a/src/app/components/OptionSelect.tsx b/src/app/components/OptionSelect.tsx index 71fd069f..9a8ef716 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; + 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( {