Skip to content

AngularFirestoreCollection get function returns non generic QuerySnapshot #2438

@batchi92

Description

@batchi92

Version info

Angular: 8.2.14

Firebase: 7.14.2

AngularFire: 5.4.2

Ionic: 5.0.7

Capacitor: 2.0.1

How to reproduce these conditions

let users: Array<{ username: string }>

this.fireStore.collection<{ username: string }>('users').get().subscribe(querySnapshot => {
users = querySnapshot.docs.map(doc => doc.data())
})

Debug output

Type 'DocumentData[]' is not assignable to type '{ username: string; }[]'.
Property 'username' is missing in type 'DocumentData' but required in type '{ username: string; }'.

Expected behavior

The QueryDocumentSnapshot's data() functions return value should be of the type '{ username: string; }'

Actual behavior

Its return value is of the type DocumentData

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions