Skip to content

collection function has no generic type #3073

Closed

Description

@zadokdaniel

Version info

Angular:
12.2.0
Firebase:
9.4.0
AngularFire:
7.2.0

How to reproduce these conditions

import {
collection,
} from '@angular/fire/firestore';

Expected behavior

collection suppose to receive generic type of collection documents interface. as stated in docs

import { collection } from '@angular/fire/firestore';
collection(firestore, 'foo') // CollectionReference

Actual behavior

generic type is not configured, hence causing a problem on passing to update and doc functions with the generic type of the interface set
Code_Y7nW5tuIqt
chrome_9x67l0gpG5

.

Activity

  1. google-oss-bot commented on Nov 22, 2021

    @google-oss-bot

    This issue does not seem to follow the issue template. Make sure you provide all the required information.

  2. RobbyRabbitman commented on May 19, 2022

    @RobbyRabbitman

    I was also surprised, since the other functions are generic. As a workaround u can type it for now manually:

    protected readonly resumesCollection = collection( this.firestore, 'resumes' ) as CollectionReference<Resume>;

    and then those calls will infer the type

    getDocs(query(this.resumesCollection, where('user', '==', user?.uid)))

  3. armando-navarro commented on Nov 5, 2026

    @armando-navarro
    Collaborator

    Thanks for filing this. Sorry this sat for years. It is the same question as #3081, so I am answering in one place: the collection() signature is the Firebase SDK's own, the typed path is withConverter(), and #3838 updates the README and quickstart, which were showing the call that fails.

    The full explanation is on #3081. If that does not work for your use case, let me know and I will follow up.

  4. added
    comp: firestoreCloud Firestore (src/firestore).
    comp: typingsTypeScript type correctness across the public API.
    type: featureNew capability or enhancement.
    on Nov 5, 2026
  5. added this to the 22.0.0-rc.1 milestone on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp: firestoreCloud Firestore (src/firestore).comp: typingsTypeScript type correctness across the public API.type: featureNew capability or enhancement.version: legacy (v7-v16)Targets the older modular API (roughly v7-v16).

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions