Firebase-js-sdk: interface DataSnapshot should have a type param

Created on 5 Jul 2017  路  2Comments  路  Source: firebase/firebase-js-sdk

  • 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

  interface DataSnapshot<S> {
    child(path: string): firebase.database.DataSnapshot<any>;
    exists(): boolean;
    exportVal(): S;
    forEach(action: (a: firebase.database.DataSnapshot<S>) => 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;
  }
p3 database help-wanted enhancement

Most helpful comment

This seems like a great potential PR!

All 2 comments

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

This seems like a great potential PR!

Was this page helpful?
0 / 5 - 0 ratings