Closed danieleades closed 3 years ago
https://github.com/tk0miya/docutils-stubs/blob/24b92fe1e4732e5e29567a11b7aa402ac25a4bba/docutils-stubs/parsers/rst/__init__.pyi#L50
subclasses of Directive will return, i believe, lists of subclasses of Node, rather than lists of Node.
Directive
Node
List[Derived] is not compatible with List[Base] (see http://mypy.readthedocs.io/en/latest/generics.html#variance-of-generic-types)
List[Derived]
List[Base]
this throws an error with the sphinx extension 'todo' example
is it possible to use Sequence here instead of List?
Sequence
List
another option might be to use a Generic parameter? i'm really not sure of the best solution here
Generic
Indeed. But I don't know a better way to describe its type.
+1 for using Sequence instead.
https://github.com/tk0miya/docutils-stubs/blob/24b92fe1e4732e5e29567a11b7aa402ac25a4bba/docutils-stubs/parsers/rst/__init__.pyi#L50
subclasses of
Directive
will return, i believe, lists of subclasses ofNode
, rather than lists ofNode
.List[Derived]
is not compatible withList[Base]
(see http://mypy.readthedocs.io/en/latest/generics.html#variance-of-generic-types)this throws an error with the sphinx extension 'todo' example
is it possible to use
Sequence
here instead ofList
?