Skip to content

Refactor: Variables are missing in props validation (let's rewrite JS to TS) 52 #9634

@AlexeyGirin

Description

@AlexeyGirin

Problem: Variables are missing in props validation
React components should validate prop types

Why is this an issue?
In JavaScript, props are typically passed as plain objects, which can lead to errors and confusion when working with components that have specific prop requirements. However, it lacks of type safety and clarity when passing props to components in a codebase.

By defining types for component props, developers can enforce type safety and provide clear documentation for the expected props of a component. This helps catch potential errors at compile-time. It also improves code maintainability by making it easier to understand how components should be used and what props they accept.

How can I fix it?
Let re-write the entire file on TypeScript and define types for all props.
Please check if types you you want to declare already exist and if no - create new declatations at types.ts if they can be used elsewhere (if yes - use existed one)

Problem locations:
packages/ketcher-react/src/script/ui/action/server.js

IMPORTANT: Please do not delete old jsx file and create new tsx one, but add changes to existed file and rename it. That let me easily compare changes you made

Metadata

Metadata

Assignees

Labels

SonarBucket: Issues found by Sonar scanner

Type

No type

Projects

Status

In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions