Skip to content

Commit

Permalink
Add missing type definitions to QueryProps
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhefner committed May 6, 2019
1 parent b489a31 commit 010fefd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,20 +245,20 @@ Query.propTypes = {
query: PropTypes.object,
parser: PropTypes.func,
skip: PropTypes.bool,
onRequest: PropTypes.func,
onLoad: PropTypes.func,
onError: PropTypes.func,
onLoad: PropTypes.func,
onRequest: PropTypes.func,
};

Query.defaultProps = {
children: ({data, error, loading}) => null,
include: 10,
query: {},
skip: false,
parser: (data) => data,
onRequest: () => {},
onLoad: () => {},
parser: (data, props) => data,
onError: () => {},
onLoad: () => {},
onRequest: () => {},
};

export default withContentful(Query);
15 changes: 13 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,23 @@ export function getDisplayName(WrappedComponent: Component): string;

export type ParserHandler = (data: any, props: any) => any;

export interface QueryState {
loading: boolean;
data?: any;
error?: any;
}

export interface QueryProps {
parser?: ParserHandler;
id?: string;
contentType?: string;
id?: string;
include?: number;
locale?: string;
parser?: ParserHandler;
query?: object;
skip?: boolean;
onError?: (state: QueryState) => void;
onLoad?: (state: QueryState) => void;
onRequest?: (state: QueryState) => void;
}

export class Query extends Component<QueryProps> {}
Expand Down

0 comments on commit 010fefd

Please sign in to comment.