firesage
Version:
🔥 Extremely High Precision Typescript Wrapper for Firestore Web, Providing Unparalleled Type Safe and Dev Experience
27 lines (26 loc) • 1.57 kB
TypeScript
import { MetaType, DocumentReference, FirestoreAndFirestoreTesting, IsValidID } from '../types';
export declare const docCreator: <T extends MetaType>(fStore: FirestoreAndFirestoreTesting, collectionPath: T["collectionPath"]) => Doc<T>;
declare type Doc<T extends MetaType> = {
/**
* Gets a `DocumentReference` instance that refers to the document at the
* specified absolute path.
*
* @param path - A slash-separated path to a document.
* @throws If the final path has an odd number of segments and does not point to
* a document.
* @returns The `DocumentReference` instance.
*/
<DocumentId extends T['docID']>(documentID: DocumentId extends never ? DocumentId : DocumentId extends IsValidID<DocumentId, 'Document', 'ID'> ? T['docID'] : IsValidID<DocumentId, 'Document', 'ID'>): DocumentReference<T>;
/**
* Gets a `DocumentReference` instance that refers to the document at the
* specified absolute path.
*
* @param firestore - A reference to the root `Firestore` instance.
* @param path - A slash-separated path to a document.
* @throws If the final path has an odd number of segments and does not point to
* a document.
* @returns The `DocumentReference` instance.
*/
<DocumentId extends T['docID']>(firestore: FirestoreAndFirestoreTesting, documentID: DocumentId extends never ? DocumentId : DocumentId extends IsValidID<DocumentId, 'Document', 'ID'> ? T['docID'] : IsValidID<DocumentId, 'Document', 'ID'>): DocumentReference<T>;
};
export {};