firebase / firebase/firebase-admin-node

[Firestore] Typescript error on date

Offen
#1,965 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
api: firestore needs-triage
Vorherrschende Sprache
TypeScript
Sterne
1.7k
Forks
419
Ø Merge
3 T. 10 Std.
Gemergte PRs (30 T.)
16

Beschreibung

My environment

* Operating System version: macOS Monterey
* Firebase SDK version: 11.2.0
* Firebase Product: Firestore
* Node.js version: v16.17.1
* NPM version: 8.19.2

#### Steps to reproduce:

Just request a document with a timestamp, and get the seconds on the object:

```js
data.entryDate.seconds
```

and I get this typescript error:

```js
Any
Property 'seconds' does not exist on type 'string'.
Translation: You're trying to access seconds on an object that doesn't contain it.
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Reproduce the issue with Firebase Admin SDK 11.2.0 on Node.js using a Firestore document containing a timestamp, then inspect the inferred type of data.entryDate. Compare the type with the runtime object and verify that accessing data.entryDate.seconds is correctly accepted by TypeScript when the fix is complete.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
nodejs, typescript
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.