Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
samtstern opened this issue Feb 3, 2021 · 0 comments · Fixed by #4418
Closed

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

samtstern opened this issue Feb 3, 2021 · 0 comments · Fixed by #4418

Comments

@samtstern
Copy link
Contributor

[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.

@samtstern samtstern added the alpha label Feb 3, 2021
@firebase firebase locked and limited conversation to collaborators Mar 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants