firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

interface DataSnapshot should have a type param

Open anfedorov opened this issue 8 years ago • 3 comments

  • 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;
  }

anfedorov avatar Jul 05 '17 06:07 anfedorov

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

google-oss-bot avatar Jul 05 '17 06:07 google-oss-bot

This seems like a great potential PR!

jshcrowthe avatar Oct 04 '17 17:10 jshcrowthe

Hi! I’d like to work on this issue. Could you please assign it to me if it’s still available?

Navya-arugonda avatar Nov 25 '25 04:11 Navya-arugonda