Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions .changeset/silver-jeans-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@firebase/database-compat': patch
'@firebase/database-types': patch
'@firebase/database': patch
---

Added non-null parent properties to ThenableReference
4 changes: 4 additions & 0 deletions common/api-review/database.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ export function startAt(value?: number | string | boolean | null, key?: string):

// @public
export interface ThenableReference extends DatabaseReference, Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
// (undocumented)
key: string;
// (undocumented)
parent: DatabaseReference;
}

// @public
Expand Down
22 changes: 22 additions & 0 deletions docs-devsite/database.thenablereference.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,25 @@ export declare interface ThenableReference extends DatabaseReference, Pick<Promi
```
<b>Extends:</b> [DatabaseReference](./database.databasereference.md#databasereference_interface)<!-- -->, Pick&lt;Promise&lt;[DatabaseReference](./database.databasereference.md#databasereference_interface)<!-- -->&gt;, 'then' \| 'catch'&gt;

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [key](./database.thenablereference.md#thenablereferencekey) | string | |
| [parent](./database.thenablereference.md#thenablereferenceparent) | [DatabaseReference](./database.databasereference.md#databasereference_interface) | |

## ThenableReference.key

<b>Signature:</b>

```typescript
key: string;
```

## ThenableReference.parent

<b>Signature:</b>

```typescript
parent: DatabaseReference;
```
5 changes: 4 additions & 1 deletion packages/database-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ export interface TransactionResult {

export interface ThenableReference
extends Reference,
Pick<Promise<Reference>, 'then' | 'catch'> {}
Pick<Promise<Reference>, 'then' | 'catch'> {
key: string;
parent: Reference;
}

export function enableLogging(
logger?: boolean | ((a: string) => any),
Expand Down
5 changes: 4 additions & 1 deletion packages/database/src/api/Reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ export interface DatabaseReference extends Query {
*/
export interface ThenableReference
extends DatabaseReference,
Pick<Promise<DatabaseReference>, 'then' | 'catch'> {}
Pick<Promise<DatabaseReference>, 'then' | 'catch'> {
key: string;
parent: DatabaseReference;
}

/** A callback that can invoked to remove a listener. */
export type Unsubscribe = () => void;
Expand Down
5 changes: 4 additions & 1 deletion packages/database/src/api/Reference_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,10 @@ export function onDisconnect(ref: DatabaseReference): OnDisconnect {

export interface ThenableReferenceImpl
extends ReferenceImpl,
Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {}
Pick<Promise<ReferenceImpl>, 'then' | 'catch'> {
key: string;
parent: ReferenceImpl;
}

/**
* Generates a new child location using a unique key and returns its
Expand Down
5 changes: 4 additions & 1 deletion packages/firebase/compat/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7370,7 +7370,10 @@ declare namespace firebase.database {

interface ThenableReference
extends firebase.database.Reference,
Pick<Promise<Reference>, 'then' | 'catch'> {}
Pick<Promise<Reference>, 'then' | 'catch'> {
key: string;
parent: Reference;
}

/**
* Logs debugging information to the console.
Expand Down
Loading