Skip to content
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

Update Database types #830

Merged
merged 3 commits into from
Apr 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/database.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ export namespace admin.database {
*/
on(
eventType: admin.database.EventType,
callback: (a: admin.database.DataSnapshot | null, b?: string) => any,
cancelCallbackOrContext?: Object | null,
callback: (a: admin.database.DataSnapshot, b?: string | null) => any,
cancelCallbackOrContext?: ((a: Error) => any) | Object | null,
context?: Object | null
): (a: admin.database.DataSnapshot | null, b?: string) => any;

Expand Down Expand Up @@ -1024,8 +1024,8 @@ export namespace admin.database {
*/
once(
eventType: admin.database.EventType,
successCallback?: (a: admin.database.DataSnapshot, b?: string) => any,
failureCallbackOrContext?: Object | null,
successCallback?: (a: admin.database.DataSnapshot, b?: string | null ) => any,
failureCallbackOrContext?: ((a: Error) => void) | Object | null,
context?: Object | null
): Promise<admin.database.DataSnapshot>;

Expand Down Expand Up @@ -1272,6 +1272,7 @@ export namespace admin.database {
* ```
*/
root: admin.database.Reference;
/** @deprecated Removed in next major release to match Web SDK typings. */
path: string;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we should make this change, but this doesn't exist in the Web types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If Reference.path is truly undefined let's remove it. Otherwise, let's call it deprecated for now and remove from a future major version.

Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian Apr 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make it deprecated. We removed in a major release on Web as well. FWIW, it is not actually a string but a util.Path object whose API is internal.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes no sense to remove this. Why require developers to individually create helper functions to fetch the string path from every reference instead of keeping this useful variable?

Every time I deploy my functions I'm greeted by a wall of "path is depreciated" messages... Why should I need to make a function called getPath(reference) that is prone to errors and needed to be referenced throughout my entire codebase when this does exactly what it needs to do?

Consider continuing support for this since the justification to depreciate it is so flimsy.


/**
Expand Down