BUG: Resample.aggregate raising TypeError instead of SpecificationError with missing keys dtypes
- [x] closes #39025
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry

Thanks @phofl for the PR. There is a very similar issue `pandas/core/aggregation.py:485: error: Value of type variable "_LT" of "sorted" cannot be "Optional[Hashable]"  [type-var]` that I didn't yet add an issue for.

There are many tests that go through that path that could be used as the basis for a test for a fix.

<details>

```
=============================================== short test summary info ================================================
FAILED pandas/tests/base/test_misc.py::test_memory_usage[series-with-empty-index] - assert 0 == 108
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 0-ops0-names0] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 0-ops1-names1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 0-ops2-names2] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 0-ops3-names3] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 1-ops0-names0] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 1-ops1-names1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 1-ops2-names2] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 1-ops3-names3] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'index'-ops0-names0] - Assertio...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'index'-ops1-names1] - Assertio...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'index'-ops2-names2] - Assertio...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'index'-ops3-names3] - Assertio...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'columns'-ops0-names0] - Assert...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'columns'-ops1-names1] - Assert...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'columns'-ops2-names2] - Assert...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_listlike[axis 'columns'-ops3-names3] - Assert...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_listlike[DataFrame-ops0] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_listlike[DataFrame-ops1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 0-dict] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 0-Series] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 1-dict] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 1-Series] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 'index'-dict] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 'index'-Series] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 'columns'-dict] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_dictlike[axis 'columns'-Series] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_dictlike[DataFrame-ops1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_dictlike[DataFrame-ops2] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_dictlike[DataFrame-ops3] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_dictlike[DataFrame-ops4] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_empty_dictlike[DataFrame-ops5] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_and_agg_err[axis 0] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_and_agg_err[axis 1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_and_agg_err[axis 'index'] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_and_agg_err[axis 'columns'] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_agg_dict_nested_renaming_depr - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[sum-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[max-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[min-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[mean-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[prod-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[std-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[var-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[median-DataFrame] - AssertionE...
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[kurt-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[skew-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[all-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_reducer_raises[any-DataFrame] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-cummax] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-cummin] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-cumprod] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-cumsum] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-diff] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-pct_change] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-rank] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_bad_dtype[DataFrame-<lambda>] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[cummax] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[cummin] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[cumprod] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[cumsum] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[diff] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[pct_change] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_partial_failure[rank] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_missing_columns[axis 0] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_missing_columns[axis 1] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_missing_columns[axis 'index'] - AssertionError
FAILED pandas/tests/frame/apply/test_frame_transform.py::test_transform_missing_columns[axis 'columns'] - AssertionError
FAILED pandas/tests/series/apply/test_series_transform.py::test_transform_none_to_type - AssertionError
```

AssertionError due to `assert False` added to code

</details>

so could either fix here, or shall I create a dedicated bug report?


update: ignore `FAILED pandas/tests/base/test_misc.py::test_memory_usage[series-with-empty-index] - assert 0 == 108` as unrelated. (maybe WSL issue, not yet investigated) I could look into this in the evening, when this pr is not merged until then we could do this here  @simonjayhawkins  Fixed it.

I am not quite sure why the test was where it was, so I moved it into the frame folder. i know we marked the issues as a regression but that was from 1.0.x, so 1.3 is fine. Thought the same, since only the message is the problem thanks @phofl 