unfire
Version:
⚡️ Utilities for Firebase 🔥 built with Composition API, Typescript and ❤️
50 lines (47 loc) • 1.53 kB
TypeScript
import { Ref } from 'vue';
/**
* Vue related
*/
declare type MaybeRef<T> = T | Ref<T>;
/**
* Utility types
*/
declare type IsUnion<T, S = T> = T extends S ? [S] extends [T] ? false : true : false;
declare type IsReadonlyArray<T> = Readonly<T> extends T ? true : false;
declare type InferType<T> = T extends infer Type ? Type : never;
declare type WidenPrimitive<T> = T extends number ? number : T extends string ? string : T extends boolean ? boolean : T;
declare type WidenIfNotUnion<T> = IsUnion<T> extends true ? T : WidenPrimitive<T>;
/**
* Plugin options.
*/
declare type FirebaseConfig = {
apiKey?: string;
authDomain?: string;
databaseURL?: string;
projectId?: string;
storageBucket?: string;
messagingSenderId?: string;
appId?: string;
};
interface Options {
/**
* Relative paths to the firebase directory.
* @default 'src/firebase/firestore'
*/
firestoreDirs?: string | string[];
/**
* Generate TypeScript declaration for firestore collection path to collection type definition
*
* @default true
*/
dts?: boolean | string;
firebaseConfig?: FirebaseConfig;
}
declare type ResolvedOptions = Required<Options> & {
firestoreDirs: string[];
dts: string | false;
root: string;
globs: string[];
resolvedfirestoreDirs: string[];
};
export { FirebaseConfig, InferType, IsReadonlyArray, IsUnion, MaybeRef, Options, ResolvedOptions, WidenIfNotUnion, WidenPrimitive };