Skip to content

Fix some unsafe uses of any

Warren Gifford requested to merge any-fixes into master

Created by: felixfbecker

I'm doing this now because part of why issues like #9411 (closed) is that errors in TypeScript are always any, but it can be solved by the no-unsafe-* family of ESLint rules. There are a lot of existing violations though, so it's currently just a warning.

This uncovered many real problems, e.g. fetchUser was typed to return null, but the Observable sequence didn't handle that, and there was no type error because the catchError(e => [e]) degraded the whole pipeline to Observable<any>.

Introduces a new curried type guard hasProperty() that works with unknown too so we never need any again in theory.

Also discovered multiple cases of workaround error handling that was obsolete because related PRs were merged a long time ago.

Merge request reports

Loading