Closed AutonomousCat closed 9 months ago
Hello!
You should open this issue over at typeshed (https://github.com/python/typeshed) since that's where the type hints for aiofiles are maintained.
That said, I can see the issue with your type hints. In the read_file
function, you're using str
as the annotation for mode
, but this is incorrect - aiofiles.open(mode=)
doesn't take a string, it takes a more specific type: https://github.com/python/typeshed/blob/994d22bfbb542956be24580323d5b4aeef822c77/stdlib/_typeshed/__init__.pyi#L229
I'm not sure what you should do here, so I suggest asking them for best practices here ;)
my code
what it shows in VS Code static type checking
This gives no type issue with stdlib's
open()