You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Match OptionSelect's option type to the run's select options #274
Blocked by #251, which adds the casts this ticket removes.
Problem
The run's select options do not match the type OptionSelect declares, though they work at runtime:
Binary, Analysis and RaxmlNgAnalysis (src/app/store/RunOptions.ts) have no notAvailable. OptionSelectOptionLike.notAvailable is a required boolean. At runtime OptionSelect reads undefined, which is falsy, so the select renders.
Choice<Value>.title in RunOptions.ts is string | number, and NumThreads, NumRuns, NumRepetitions and others put numbers there. OptionSelectChoice.title is string. MenuItem renders a number title fine.
Because tsc also checks src/app/App.js, which passes the store Run to the panels, #251 types these 14 fields as object in ModelRun (src/app/Model.tsx) and RaxmlRun (src/app/Raxml.tsx). It then casts each one as OptionSelectOptionLike where it is passed to <OptionSelect>. Casting from object always compiles, so none of these props is type-checked.
What to build
Make OptionSelect's declared contract match what the store passes and what the component handles, then drop the casts.
Acceptance criteria
OptionSelectOptionLike.notAvailable in src/app/components/OptionSelect.tsx is optional (notAvailable?: boolean), and OptionSelectChoice.title is string | number
In Model.tsx and Raxml.tsx, the select-option fields of ModelRun and RaxmlRun are typed OptionSelectOptionLike, not object. Every as OptionSelectOptionLike cast and the // The run's select options miss ... comment are deleted
There is no runtime change: no store class gains or loses a member, and OptionSelect's rendering is untouched
src/app/App.js gains no diagnostic, and yarn typecheck:baseline passes. Any baseline line this clears is deleted
Every other OptionSelect caller still type-checks. Find them through imports of components/OptionSelect
yarn lint, yarn react-test and yarn build pass, and tsconfig.json is unchanged
Activity
Match OptionSelect's option type to the run's select options (#274) (#…
Convert the Page, preload and alignment parsers to TypeScript (Antone…