That looks like a bug in pycharm where it’s a bit overeager in assuming that you’re using the typing module in an unintended way. See this example here where that assumption would have been correct:

The classes in the typing module are only useful in a type annotation context, not to inspect or compare to actual classes, which is what isinstance tries to do. Since pycharm sees a simple object with square brackets that do not contain a literal, it jumps to the wrong conclusion you are seeing.
Your code is fine, you can use it exactly as it is.