Skip to content

Added non-null properties to database.ThenableReference #8800

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

Merged
merged 3 commits into from
Feb 27, 2025
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