Closed Tomtec331 closed 5 months ago
Speaking of strict... when I updated React to 18, we needed to disable strict in the frontend app. Maybe this can be reverted now that we thankfully have an updated toolchain and deps...
Adding all important flags and fixing the code is finished. I also included an enhanced eslint configuration which now checks types too.
I personally used "strict-type-checked" while fixing the code but the recommended option should be enough. I haven't touched all files because I cannot reliably test the outcome. I just disabled all necessary eslint rules in these files and added a TODO:
The last two are handling the express API paths which result in lots of "any" types as we're dealing with incoming data. "Celebrate" is already used - the problem is that all the parsed types are lost again after the middleware has run and we still need to cast all elements into the corresponding type - which can lead to new issues.
Nonetheless the changes have already been merge into the "develop" branch and are ready for testing.
As mentioned, I started to fixup the leftover eslint-disables. Current state:
Currently the tsconfig used in the backend is quite basic. Several useful functionalities of typescript aren't even enable. Especially the "strict" option should always be used (like in frontend). Essentially we should bring the backend in line with frontend. This would prevent many easily checkable coding mistakes.
Luckily the strict option consists of eight independent flags. So we can enable them on after another and fix emerging errors:
After all flags are set and errors are fixed the flags can be replaced with strict: true (see: https://www.typescriptlang.org/tsconfig#strict)
Additional optional options (also used in frontend) are: