Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
fix: check if proptypes can be added to StaticQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
braican committed Jul 18, 2019
1 parent 1e480ee commit f05a5e6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/gatsby-source-prismic-graphql/src/gatsby-browser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import React from 'react';
import { WrapPage } from './components/WrapPage';

// Fixes proptypes warning for StaticQuery
(StaticQuery as any).propTypes.query = PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
id: PropTypes.string,
source: PropTypes.string,
}),
]);
if (StaticQuery && typeof StaticQuery === 'object' && (StaticQuery as any).propTypes) {
(StaticQuery as any).propTypes.query = PropTypes.oneOfType([
PropTypes.string,
PropTypes.shape({
id: PropTypes.string,
source: PropTypes.string,
}),
]);
}

interface WrapPageArgs {
element: any;
Expand Down

0 comments on commit f05a5e6

Please sign in to comment.