ls1intum / Apollon

UML Modeling Editor written in React
https://apollon-library.readthedocs.io
MIT License
65 stars 22 forks source link

Update Typescript from 3.8.3 to 3.9.7 #126

Closed TobiasPr closed 4 years ago

TobiasPr commented 4 years ago

Is your feature request related to a problem?

Updating the typescript version, brings compiler errors with it. Currently we have a lot to do in Apollon, so this ticket is used to describe the changes which need to be done at a later point.

Describe the problems

For breaking changes, see: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#breaking-changes Especially relevant for us: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-9.html#stricter-checks-on-intersections-and-optional-properties With this change we have 56 compiler errors at first sight related to transpiling typescript to javascript. There are more issues, because fixing one of the issues resolves often in a chain of issues which need to be resolved

Causes:

Examples

Example 1: stricter checks on intersections and optional properties

This brings some problems, e.g. multiline.tsx:

image

The problem here is, that we have the property x and y coming multiple times in the tsx, one time from textProps and directly specified in the tsx. This should be easily solvable by manually handling the default value

The same problem applies to various places, where we have intersection types which include properties from different types with different type annotations for certain properties

Example 2: more type inference / different type inference

Also the types of event annotations have changed: image

so e.g. FormEvent<HTMLInputElement> -> ChangeEvent<HTMLTextAreaElement> for onChange of text input fields

Example 2: more type inference / different type inference

in StyledTextfield image

we now have to give a manual type declaration, because the inferred is marked as a compiler error . Be careful, just using type any will not solve the issue, because we want to achieve type safety and not disable typechecking use something like props: Props & { theme: Styles }

TobiasPr commented 4 years ago

Done