firebase / firebase/firebase-js-sdk

interface DataSnapshot should have a type param

Open
#88 3 comments 3 reactions 0 assignees View on GitHub
api: database enhancement feature request help-wanted Priority: p3
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

* Operating System version: n/a
* Firebase SDK version: latest
* Firebase Product: database

### Describe the problem
I'd like to define types of things in my firebase repo. `DataSnapshot.val()` returns `any`.

#### Steps to reproduce:
call `.val` on a `DataSnapshot`

#### Potential Fix

```javascript
interface DataSnapshot {
child(path: string): firebase.database.DataSnapshot;
exists(): boolean;
exportVal(): S;
forEach(action: (a: firebase.database.DataSnapshot) => boolean): boolean;
getPriority(): string | number | null;
hasChild(path: string): boolean;
hasChildren(): boolean;
key: string | null;
numChildren(): number;
ref: firebase.database.Reference;
toJSON(): Object | null;
val(): S;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.