[ty] Sync vendored typeshed stubs (#20876)

Close and reopen this PR to trigger CI

---------

Co-authored-by: typeshedbot <>
Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
github-actions[bot] 2025-10-15 11:13:32 +02:00 committed by GitHub
parent 651f7963a7
commit cafb96aa7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 487 additions and 288 deletions

View file

@ -30,3 +30,27 @@ class B: ...
# error: "Operator `|` is unsupported between objects of type `<class 'A'>` and `<class 'B'>`"
reveal_type(A | B) # revealed: Unknown
```
## Other binary operations resulting in `UnionType`
```toml
[environment]
python-version = "3.12"
```
```py
class A: ...
class B: ...
def _(sub_a: type[A], sub_b: type[B]):
reveal_type(A | sub_b) # revealed: UnionType
reveal_type(sub_a | B) # revealed: UnionType
reveal_type(sub_a | sub_b) # revealed: UnionType
class C[T]: ...
class D[T]: ...
reveal_type(C | D) # revealed: UnionType
reveal_type(C[int] | D[str]) # revealed: UnionType
```