Title: Type Mismatch DocumentSnapshot of AsyncCollectionReference · Issue #15367 · googleapis/google-cloud-python · GitHub
Open Graph Title: Type Mismatch DocumentSnapshot of AsyncCollectionReference · Issue #15367 · googleapis/google-cloud-python
X Title: Type Mismatch DocumentSnapshot of AsyncCollectionReference · Issue #15367 · googleapis/google-cloud-python
Description: Environment details OS type and version: MacOS Sequoia 15.6 Python version: 3.13.5 pip version 25.1.1 google-cloud-firestore version: 2.21.0 Description There's a type inconsistency between the IDE's type hints and the actual returned ty...
Open Graph Description: Environment details OS type and version: MacOS Sequoia 15.6 Python version: 3.13.5 pip version 25.1.1 google-cloud-firestore version: 2.21.0 Description There's a type inconsistency between the IDE...
X Description: Environment details OS type and version: MacOS Sequoia 15.6 Python version: 3.13.5 pip version 25.1.1 google-cloud-firestore version: 2.21.0 Description There's a type inconsistency between the...
Opengraph URL: https://github.com/googleapis/google-cloud-python/issues/15367
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type Mismatch DocumentSnapshot of AsyncCollectionReference","articleBody":"\n#### Environment details\n\n - OS type and version: MacOS Sequoia 15.6\n - Python version: 3.13.5\n - pip version 25.1.1\n - `google-cloud-firestore` version: 2.21.0\n\n#### Description\nThere's a type inconsistency between the IDE's type hints and the actual returned types when working with Firestore's AsyncClient.\n\n#### Steps to reproduce\n\n 1. Initialize async client\n 2. Make a query on a collection\n 3. fetch query data using `await query.get()`\n 4. the IDE suggest the return type of `google.cloud.firestore_v1.query_results.QueryResultsList[DocumentSnapshot]`\n 5. call `.reference` on any object of the query, the IDE will suggest that the return type would be `google.cloud.firestore_v1.base_document.DocumentSnapshot`\n 6. in reality the document returned is `google.cloud.firestore_v1.async_document.AsyncDocumentReference`\n\n#### Code example\n\n```python\nimport firebase_admin\nfirebase_admin.initialize_app()\naclient = firestore_async.firestore.AsyncClient(database=\"(default)\")\nusers = await aclient.collection(\"users\").get()\nprint(type(users[0]))\n# \u003cclass 'google.cloud.firestore_v1.base_document.DocumentSnapshot'>\nprint(type(users[0].reference)) # Mismatch between type hint and actual type. see the references \n# \u003cclass 'google.cloud.firestore_v1.async_document.AsyncDocumentReference'>\n```\n##### references\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/async_collection.py#L199-L244\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/async_collection.py#L72-L78\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/async_collection.py#L199-L244\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/async_query.py#L189-L263\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/base_document.py#L441-L449\nhttps://github.com/googleapis/python-firestore/blob/49836391dc712bd482781a26ccd3c8a8408c473b/google/cloud/firestore_v1/async_collection.py#L246-L254\n\n","author":{"url":"https://github.com/UmarFarooq-Ch","@type":"Person","name":"UmarFarooq-Ch"},"datePublished":"2025-08-04T10:17:49Z","url":"https://github.com/googleapis/google-cloud-python/issues/15367"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5dd7d78f-31a2-7795-0d4e-8c047a33c0a9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DBA4:24FA46:136067:1A24CB:6AFE3596 |
| html-safe-nonce | b4705e10c22c7f2aeb1dd16191904c62d99f5a22eaff9706c47e84fd40ce74db |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQkE0OjI0RkE0NjoxMzYwNjc6MUEyNENCOjZBRkUzNTk2IiwidmlzaXRvcl9pZCI6Ijg2ODgxMzI4MTkwODUzMDkzMzQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7c5120d30cef846b1fe8738f3ec4cd802131d11bdf64b50081b59b7cbf6c9cea |
| hovercard-subject-tag | issue:3809677840 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/googleapis/google-cloud-python/15367/issue_layout |
| twitter:image | https://opengraph.githubassets.com/358dc926424d6db7c42b5bf9ba524f85f3f28f59b783b4c35e16666bb9870c7e/googleapis/google-cloud-python/issues/15367 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/358dc926424d6db7c42b5bf9ba524f85f3f28f59b783b4c35e16666bb9870c7e/googleapis/google-cloud-python/issues/15367 |
| og:image:alt | Environment details OS type and version: MacOS Sequoia 15.6 Python version: 3.13.5 pip version 25.1.1 google-cloud-firestore version: 2.21.0 Description There's a type inconsistency between the IDE... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | UmarFarooq-Ch |
| hostname | github.com |
| expected-hostname | github.com |
| None | 260deedcf4630abb0a6b4aaa02fd2af70eab44d2529712694ceae59ca131b02e |
| turbo-cache-control | no-preview |
| go-import | github.com/googleapis/google-cloud-python git https://github.com/googleapis/google-cloud-python.git |
| octolytics-dimension-user_id | 16785467 |
| octolytics-dimension-user_login | googleapis |
| octolytics-dimension-repository_id | 16316451 |
| octolytics-dimension-repository_nwo | googleapis/google-cloud-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16316451 |
| octolytics-dimension-repository_network_root_nwo | googleapis/google-cloud-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8b413ea7a9b010f4f2ebbb923b041b0d6091dd94 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width