Add mypy checks.

mypy checks have been added to the gitlab pipeline.
They can be triggered via `make mypy`.

Some (minor) fixes to error checks are inlcuded.
2 jobs for T293382-add-typing