Improve type annotations in `synapse.module_api`.