Fix rendering of nested type annotations with alias defined
Subject: Fix rendering of nested type annotations with alias defined
Feature or Bugfix
- Bugfix
Purpose
- Make autodoc usable with nested types with alias defined
Detail
The current implementation replaces type annotations with a alias defined by the class TypeAliasForwardRef. This class is later again replaced by the type defined in the alias map.
This commit fixes the problem that this second replacement does not happen if the aliased type is nested in another generic type (e.g. Iterator[aliased_type]). The new function goes recursivly through the nested types and replaces the internal class TypeAliasForwardRef again by the correct annotation.
Relates
I've been getting the error unhashable type: 'TypeAliasForwardRef' with nitpicky=True with certain types of nested type hints. This PR makes them go away.
(side question: is it possible to tell autodoc to just completely not try to make type hints into cross-references?)