firebase / firebase/firebase-admin-node
[Firestore] Typescript error on date
未关闭
api: firestore
needs-triage
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 3 天 10 小时
- 30 天内合并 PR
- 16
描述
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.
```
贡献指南
调研方向
使用包含时间戳的 Firestore 文档,在 Node.js 上通过 Firebase Admin SDK 11.2.0 重现该问题,然后检查 data.entryDate 的推断类型。将该类型与运行时对象进行比较,并验证修复完成后 TypeScript 能正确接受对 data.entryDate.seconds 的访问。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- nodejs, typescript
- 领域
- databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100