fix type errors
This commit is contained in:
parent
2f2c586d5d
commit
91da39370f
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
import { DocumentSnapshot, Transaction } from 'firebase-admin/firestore'
|
import { DocumentSnapshot, Transaction } from 'firebase-admin/firestore'
|
||||||
import { isEqual, zip } from 'lodash'
|
import { isEqual, zip } from 'lodash'
|
||||||
import { UpdateSpec } from '../utils'
|
|
||||||
|
|
||||||
export type DocumentValue = {
|
export type DocumentValue = {
|
||||||
doc: DocumentSnapshot
|
doc: DocumentSnapshot
|
||||||
|
@ -54,7 +53,7 @@ export function getDiffUpdate(diff: DocumentDiff) {
|
||||||
return {
|
return {
|
||||||
doc: diff.dest.doc.ref,
|
doc: diff.dest.doc.ref,
|
||||||
fields: Object.fromEntries(zip(diff.dest.fields, diff.src.vals)),
|
fields: Object.fromEntries(zip(diff.dest.fields, diff.src.vals)),
|
||||||
} as UpdateSpec
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyDiff(transaction: Transaction, diff: DocumentDiff) {
|
export function applyDiff(transaction: Transaction, diff: DocumentDiff) {
|
||||||
|
|
|
@ -47,7 +47,7 @@ export const writeAsync = async (
|
||||||
const batch = db.batch()
|
const batch = db.batch()
|
||||||
for (const { doc, fields } of chunks[i]) {
|
for (const { doc, fields } of chunks[i]) {
|
||||||
if (operationType === 'update') {
|
if (operationType === 'update') {
|
||||||
batch.update(doc, fields)
|
batch.update(doc, fields as any)
|
||||||
} else {
|
} else {
|
||||||
batch.set(doc, fields)
|
batch.set(doc, fields)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user