Improve type hints, and bump types-psycopg2 from 2.9.21.11 to 2.9.21.14.