from typing import Any, Union
from pandas import Index
S = Union['Index[Any]']
pyright 1.1.55 (no --lib option) fails with:
4:18 - error: "Any" is unbound (reportUnboundVariable)
Python 3.6.10
Removing Any is my workaround for now.
Thanks for the bug report. This will be fixed in the next version of Pyright & Pylance.
If you do not need a forward reference here, you can remove the quotes as a workaround.
Removing the quotes works on the pyright CLI but gives me the following in VSCode:
Value 'Index' is unsubscriptable pylint(unsubscriptable-object)
I think this is because it's Python 3.6 without PEP 563 "postponed evaluations of type annotations"
This is addressed in Pyright 1.1.56, which I just published. It will also be in the next version of Pylance.