Missing return type on function useAppDispatch

Solution 1:

Disable the rule, at least in this line. It is what it is.

Seriously, this rule is harmful. You do not need to have each and every existing eslint rule active and rules that force annotation with certain types are especially harmful, causing you to remove available type information.

If something is wrong, you will still get a type error, just at usage of the function, not at definition.

There is one place where you need to annotate types and that is in function input positions - because there they cannot be inferred. Everything else is optional. Sometimes it helps readability, sometimes it actively hinders it. Use your mind at that point, don't stick to a fixed rule.

Especially with Redux Toolkit, you get a lot of very specific types and manually annotating those will require you to either duplicate your code in types, or to annotate it in a way that you lose valuable information.