firebase / firebase/firebase-js-sdk

[Question]: WriteBatch and Transaction method return types

Open
#6,437 7 comments 0 reactions 1 assignee Claimed by @cherylEnkidu View on GitHub
api: firestore feature request
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

I'm working on an internal code library and I have some code that is only concerned with `set()`, `update()` and `delete()` methods of `WriteBatch` and `Transaction`. I notice the only thing that differs between the methods is the return type. Transaction return type is `:this` and WriteBatch is `:WriteBatch`

For example the set()'s:
- https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/lite-api/transaction.ts#L130
- https://github.com/firebase/firebase-js-sdk/blob/master/packages/firestore/src/lite-api/write_batch.ts#L76

I wondered if it would be a possibility for them to all use the `:this` return type? I'd like to be able to use the 2 types interchangeably based on an interface of only those few methods. Thank you for your time.

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.