Improve type hinting in the user directory code.