error on union with a quoted type and an unquoted type is only reported as an error when `enableExperimentalFeatures` is enabled
While Optional is a matter of taste, there are certain cases where Union is required. Assume there's a "B" type defined lower in a file. The following hints fail with the pipe syntax, but succeed with Union.
class A: pass C = A | "B" # => TypeError: unsupported operand type(s) for |: 'type' and 'str C = Union[A, "B"] # => Works! class B: passbasedpyright already handles this scenario gracefully:
C = int | "A" # Union syntax cannot be used with string operand; use quotes around entire expression (reportGeneralTypeIssues)
class A: ...
Basedpyright seem to stop emitting an error since 1.20.0 (1.19.1 do emit one), is that intentional?
https://basedpyright.com/?pyrightVersion=1.20.0&typeCheckingMode=all&code=MIAgvCCWB2AuIB8QCICCyBQGDGAbAhgM6EioBcGIVIAdHRkA
Originally posted by @Glinte in #734
this is a runtime error so basedpyright should report an error regardless