mirror of
https://github.com/microsoft/pyright.git
synced 2024-08-17 03:40:44 +03:00
More docs improvements.
This commit is contained in:
parent
c7dfba390d
commit
997fd7d57c
@ -57,10 +57,10 @@ In this example, the type evaluator knows that parameter a is either None, str,
|
||||
Narrowing is also applied values are assigned to a variable.
|
||||
|
||||
```python
|
||||
def func():
|
||||
def func(b: Optional[Union[str, List[str]]]):
|
||||
# The declared type of “a” is a union of three types
|
||||
# (str, List[str] and None).
|
||||
a: Optional[Union[str, List[str]]]
|
||||
a: Optional[Union[str, List[str]]] = b
|
||||
reveal_type(a) # Type is `Optional[Union[str, List[str]]]`
|
||||
|
||||
a = "hi"
|
||||
|
Loading…
Reference in New Issue
Block a user