firesage
Version:
🔥 Extremely High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
11 lines (8 loc) • 897 B
TypeScript
import { ArrayUnionOrRemove, ErrorArrayFieldValueEmpty } from '../types';
/**
Returns a special value that can be used with @firebase/firestore/lite#(setDoc:1) or * @firebase/firestore/lite#(updateDoc:1) that tells the server to union the given elements with any array value that already exists on the server. Each specified element that doesn't already exist in the array will be added to the end. If the field being modified is not already an array it will be overwritten with an array containing exactly the specified elements.
@param elements — The elements to union into the array.
@returns
The FieldValue sentinel for use in a call to setDoc() or updateDoc().
*/
export declare const arrayUnion: <Elements extends unknown[]>(...elements: Elements extends [] ? ["Error: arrayUnion and arrayRemove need at least 1 argument"] : Elements) => ArrayUnionOrRemove<Elements[number]>;