Add type hints to return value of reader/writer functions

To avoid reflections when using them with `with-open` macro