firebase / firebase/firebase-js-sdk

Fr: Update externs for Closure users

Open
#4,592 4 comments 0 reactions 0 assignees View on GitHub
api: core feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

### [REQUIRED] Describe your environment

* Operating System version: N/A
* Browser version: N/A
* Firebase SDK version: 8.2.8
* Firebase Product: firebase-js-sdk

### [REQUIRED] Describe the problem

The externs available at **firebase-js-sdk/packages/firebase/externs/** are currently incomplete and incorrect which causes issues when using the Closure Compiler.

Products that are missing externs:
- Analytics
- Performance
- RemoteConfig

The externs for Firestore are missing definitions for the `withConverter()` method.

I think the `get()` method for `firebase.firestore.Query` should return a `Promise` to reflect the extern's comments and the [documentation](https://firebase.google.com/docs/reference/js/firebase.firestore.CollectionReference#get) for this method:

```javascript
/**
* Executes the query and returns the results as a `QuerySnapshot`.
*
* @param {!firebase.firestore.GetOptions=} options An options object to
* configure how the data is retrieved.
*
* @return {!firebase.firestore.QuerySnapshot}
* A promise that will be resolved with the results of the query.
*/
firebase.firestore.Query.prototype.get = function (options) {};
```

would become:

```javascript
/**
* Executes the query and returns the results as a `QuerySnapshot`.
*
* @param {!firebase.firestore.GetOptions=} options An options object to
* configure how the data is retrieved.
*
* @return {!Promise}
* A promise that will be resolved with the results of the query.
*/
firebase.firestore.Query.prototype.get = function (options) {};
```

The externs also produce several warnings when using `--jscomp_warning=lintChecks` due to use of `var` over `let` or `const`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.