Skip to content

Improve Typing and Functionality of Front-End Client using TypeScript

Maxence Pellouin requested to merge 50-typage-du-client into main

Created by: mpellouin

This pull request aims to improve the typing and functionality of the front-end client by creating custom types for our variables, rewriting the newDropoffs function, and using TypeScript features to improve the codebase.

Firstly, custom types have been created for our variables, which helps us to catch errors early and have more confidence in our code. This ensures that all variables have a defined type, and prevents potential bugs from being introduced into the code.

Secondly, the newDropoffs function has been rewritten to be more concise and to use better typing. This improves the functionality of the front-end client, and makes it easier for developers to understand and maintain the code.

Thirdly, the useState type has been passed as a parameter, which ensures that we have more accurate typing for our state variables. This helps us to catch any errors that may arise from type mismatches.

Finally, the FC component from React has been used to tell TypeScript that a specific const variable is a functional component. This const variable has also been given a props type as a parameter to ensure more accurate typing for the component's props.

Overall, these changes greatly improve the typing and functionality of our front-end client, making it easier to maintain and less prone to errors.

Merge request reports