Support New Python Union Typing Style
Open
emitter:python
feature
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 164
Description
Since Python 3.10 is now officially the min supported version, we should generate code using the new union operator https://docs.python.org/3/whatsnew/3.10.html#pep-604-new-type-union-operator
The new syntax is visually cleaner and offers a better IDE experience as well.
```python
def square(number: Union[int, float]) -> Union[int, float]:
return number ** 2
```
new syntax
```python
def square(number: int | float) -> int | float:
return number ** 2
```
Contributor guide
Assessment
This issue has not been assessed yet.