Describe the bug
from typing import List
a: List[str] = ["a", "bc"]
b: List[str] = sorted(a, key=len)
Causes an error:
4:16 - error: Expression of type 'List[Union[str, Sized]]' cannot be assigned to declared type 'List[str]'
Type 'Sized' cannot be assigned to type 'str'
'Sized' is incompatible with 'str'
version
1.0.81
Thanks for the bug report. I'm able to repro the problem, and I'll look into.
The fix will be in the next published version of pyright.
This is fixed in version 1.0.83, which I just published.