Repository navigation
#8459 – Refactor: Variables are missing in props validation (let's rewrite JS to TS) 10 - #8519
Conversation
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
|
@copilot in resulted
|
Changed from `.toString()` to pass numeric values directly to Select component. The Select component expects values that match the option values, which are numbers (0-7), not strings. Converting to string caused a type mismatch preventing the selected value from being displayed. Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Fixed in b799d32. The issue was that I converted the Select value to string ( |
…write JS to TS) 10 (#8519) * Initial plan * Convert Analyse.jsx to TypeScript with proper type definitions Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> * Fix: Display values in Decimal places dropdowns Changed from `.toString()` to pass numeric values directly to Select component. The Select component expects values that match the option values, which are numbers (0-7), not strings. Converting to string caused a type mismatch preventing the selected value from being displayed. Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>

How the feature works? / How did you fix the issue?
Converted
Analyse.jsxto TypeScript to enforce compile-time type safety for component props, eliminating prop validation gaps.Type definitions added:
AnalyseValues– Server response structure (gross formula, molecular weight, exact mass, elemental analysis)RoundSettings– Decimal precision configuration for numeric valuesAnalyseItem– Display item configuration with optional roundingAnalyseDialogProps– Redux state-derived props (extendsDialogParams)AnalyseDialogCallProps– Action callbacks (onAnalyse,onChangeRound)Code improvements:
roundOffhelper with explicitstring | number → stringsignaturerenderInputComponentwithReactElementreturn typeErrorsContextBefore (JavaScript):
After (TypeScript):
Bug fix:
During TypeScript conversion, the Select component's value prop was incorrectly converted to a string (
.toString()), but the Select options contain numeric values (0-7). This type mismatch prevented the selected decimal places from being displayed in the dropdown. Fixed by passing numeric values directly to match the option values type.Check list
#1234 – issue nameOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.