diff --git a/Changelog.md b/Changelog.md index ac4207c990..9e7ccda100 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ Expect active development and potentially significant breaking changes in the `0.x` track. We'll try to be diligent about releasing a `1.0` version in a timely fashion (ideally within 1 or 2 months), so that we can take advantage of SemVer to signify breaking changes from that point on. ### vNext +- Fix: convert deprecated `React.PropTypes` to `PropTypes` provided by the `prop-types` package. [PR #628](https://github.com/apollographql/react-apollo/pull/628) ### 1.0.2 - Exposed `createBatchingNetworkInterface` from apollo-client so that it can be imported from react-apollo just like `createNetworkInterface`. [PR #618](https://github.com/apollographql/react-apollo/pull/618) diff --git a/package.json b/package.json index 3c6778b7ca..53bee43893 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "mobx": "^3.1.0", "mobx-react": "^4.1.0", "pretty-bytes": "^4.0.2", + "prop-types": "^15.5.8", "react": "^15.5.4", "react-addons-test-utils": "^15.5.1", "react-dom": "^15.5.4", diff --git a/src/ApolloProvider.tsx b/src/ApolloProvider.tsx index 577d875301..c7fcd2228c 100644 --- a/src/ApolloProvider.tsx +++ b/src/ApolloProvider.tsx @@ -1,18 +1,14 @@ -/* tslint:disable:no-unused-variable */ import * as React from 'react'; -/* tslint:enable:no-unused-variable */ +import * as PropTypes from 'prop-types'; import { Component, - PropTypes, } from 'react'; import { Store, } from 'redux'; -/* tslint:disable:no-unused-variable */ import ApolloClient, { ApolloStore } from 'apollo-client'; -/* tslint:enable:no-unused-variable */ import invariant = require('invariant'); diff --git a/src/graphql.tsx b/src/graphql.tsx index e4355b0605..f0ef81dc8a 100644 --- a/src/graphql.tsx +++ b/src/graphql.tsx @@ -1,10 +1,10 @@ import { Component, createElement, - PropTypes, ComponentClass, StatelessComponent, } from 'react'; +import * as PropTypes from 'prop-types'; // modules don't export ES6 modules import pick = require('lodash.pick'); diff --git a/test/react-web/client/ApolloProvider.test.tsx b/test/react-web/client/ApolloProvider.test.tsx index 37df14a59c..dd5e7d3df5 100644 --- a/test/react-web/client/ApolloProvider.test.tsx +++ b/test/react-web/client/ApolloProvider.test.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; +import * as PropTypes from 'prop-types'; import { shallow, mount, ReactWrapper } from 'enzyme'; import { createStore } from 'redux'; import { Provider } from 'react-redux'; @@ -26,8 +27,8 @@ describe(' Component', () => { class Child extends React.Component { static contextTypes: React.ValidationMap = { - client: React.PropTypes.object.isRequired, - store: React.PropTypes.object.isRequired, + client: PropTypes.object.isRequired, + store: PropTypes.object.isRequired, }; context: ChildContext; @@ -45,8 +46,8 @@ describe(' Component', () => { } class ChildWithOptionalStore extends React.Component { static contextTypes: React.ValidationMap = { - client: React.PropTypes.object.isRequired, - store: React.PropTypes.object, + client: PropTypes.object.isRequired, + store: PropTypes.object, }; context: ChildContext; @@ -82,7 +83,7 @@ describe(' Component', () => { ); } - }; + } class ConnectedContainer extends React.Component { constructor(props) { diff --git a/test/react-web/client/graphql/queries.test.tsx b/test/react-web/client/graphql/queries.test.tsx index 032666b8fa..e0b6495680 100644 --- a/test/react-web/client/graphql/queries.test.tsx +++ b/test/react-web/client/graphql/queries.test.tsx @@ -1,6 +1,7 @@ /// import * as React from 'react'; +import * as PropTypes from 'prop-types'; import * as ReactDOM from 'react-dom'; import * as renderer from 'react-test-renderer'; import { mount } from 'enzyme'; @@ -1603,7 +1604,7 @@ describe('queries', () => { } (ContextContainer as any).childContextTypes = { - color: React.PropTypes.string, + color: PropTypes.string, }; let count = 0; @@ -1622,7 +1623,7 @@ describe('queries', () => { } (ChildContextContainer as any).contextTypes = { - color: React.PropTypes.string, + color: PropTypes.string, }; renderer.create( diff --git a/test/react-web/server/index.test.tsx b/test/react-web/server/index.test.tsx index 6112182287..ebafbbfe2f 100644 --- a/test/react-web/server/index.test.tsx +++ b/test/react-web/server/index.test.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import * as PropTypes from 'prop-types'; import * as ReactDOM from 'react-dom/server'; import ApolloClient from 'apollo-client'; import { execute, GraphQLSchema, GraphQLObjectType, GraphQLList, GraphQLString, GraphQLID } from 'graphql'; @@ -571,7 +572,7 @@ describe('SSR', () => { } (MyRootContainer as any).childContextTypes = { - color: React.PropTypes.string, + color: PropTypes.string, }; const app = (