Provide typehints for register_shutdown_function and simplify function based on them.