Skip to content

Unclear how to use ServerValue.TIMESTAMP in RTDB SDK #4406

@samtstern

Description

@samtstern

[REQUIRED] Describe your environment

  • Operating System version: macOS
  • Browser version: N/A
  • Firebase SDK version: exp
  • Firebase Product: database

[REQUIRED] Describe the problem

I can't figure out how to use ServerValue.TIMESTAMP in the new RTDB SDK.

I tried this:

const { getDatabase, ServerValue } = require("firebase/database");

But tsc says:

'ServerValue' only refers to a type, but is being used as a value here

Looking at the exported types, here's where it's defined:

/**
 * @public
 */
export interface ServerValue {
  TIMESTAMP: object;
  increment(delta: number): object;
}

Seems that we need to export an object, not just an interface

Steps to reproduce:

See:
firebase/snippets-web#98

Relevant Code:

See above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions