forked from exivity-archive/react-orbitjs
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.d.ts
35 lines (27 loc) · 1.14 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import * as React from 'react';
import Store from '@orbit/store';
import { TransformOrOperations, QueryOrExpression, QueryBuilder, Source } from '@orbit/data';
export interface DataProviderProps {
dataStore: Store;
}
export interface RecordsToProps {
[key: string]: (q: QueryBuilder) => any;
}
export interface WithData {
dataStore: Store;
sources: { [sourceName: string]: Source };
}
export type WithDataProps = {
queryStore: (queryOrExpression: QueryOrExpression, options?: object, id?: string) => any;
updateStore: (transformOrOperations: TransformOrOperations, options?: object, id?: string) => any;
dataStore: Store;
sources: { [sourceName: string]: Source };
} & WithData;
type MapRecordsToPropsFn<TWrappedProps> = (props: TWrappedProps) => RecordsToProps;
export type MapRecordsToProps<TWrappedProps> = RecordsToProps | MapRecordsToPropsFn<TWrappedProps>;
export class DataProvider extends React.Component<DataProviderProps> {}
export function withData<TWrappedProps>(
mapRecordsToProps: MapRecordsToProps<TWrappedProps>
): <Props, State>(
WrappedComponent: React.Component<any, any, any>
) => React.Component<TWrappedProps & Props>;