Type hinting fixes for sharing

@PVince81 @DeepDiver1975 please review
changes suggested by scrutinizer and own review