refire-react
Version:
React components and helpers for Refire
44 lines (43 loc) • 1.27 kB
TypeScript
/// <reference types="react" />
/// <reference types="react-redux" />
import * as React from "react";
import * as ReactRedux from "react-redux";
export interface WriteProps {
readonly dispatch?: ReactRedux.Dispatch<{}>;
readonly processing?: string[];
readonly errors?: string[];
readonly path: string;
}
export interface FirebaseWriteState {
firebase: {
writes: {
processing: {
[name: string]: string[];
};
errors: {
[name: string]: string[];
};
};
};
}
export declare type pathFunction = (state: FirebaseWriteState, ownProps: any) => string;
export interface WriteOptions {
path?: string | pathFunction;
method?: "" | "push" | "set" | "transaction" | "update";
}
export interface ExtraProps {
clearErrors?: () => void;
errors?: string[];
processing?: boolean;
submit?: (value: any) => void;
}
export default function (options?: WriteOptions): <P>(WrappedComponent: React.ComponentType<P>) => React.ComponentClass<Pick<WriteProps & P, ({
[P in keyof (WriteProps & P)]: P;
} & {
path: never;
dispatch: never;
processing: never;
errors: never;
} & {
[x: string]: never;
})[keyof (WriteProps & P)]> & P>;