Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

convert React.PropTypes to "prop-types" module #628

Merged
merged 5 commits into from
Apr 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 1 addition & 5 deletions src/ApolloProvider.tsx
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
2 changes: 1 addition & 1 deletion src/graphql.tsx
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
11 changes: 6 additions & 5 deletions test/react-web/client/ApolloProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -26,8 +27,8 @@ describe('<ApolloProvider /> Component', () => {

class Child extends React.Component<any, { store: any, client: any}> {
static contextTypes: React.ValidationMap<any> = {
client: React.PropTypes.object.isRequired,
store: React.PropTypes.object.isRequired,
client: PropTypes.object.isRequired,
store: PropTypes.object.isRequired,
};

context: ChildContext;
Expand All @@ -45,8 +46,8 @@ describe('<ApolloProvider /> Component', () => {
}
class ChildWithOptionalStore extends React.Component<any, { store: any, client: any}> {
static contextTypes: React.ValidationMap<any> = {
client: React.PropTypes.object.isRequired,
store: React.PropTypes.object,
client: PropTypes.object.isRequired,
store: PropTypes.object,
};

context: ChildContext;
Expand Down Expand Up @@ -82,7 +83,7 @@ describe('<ApolloProvider /> Component', () => {
</ApolloProvider>
);
}
};
}

class ConnectedContainer extends React.Component<any, any> {
constructor(props) {
Expand Down
5 changes: 3 additions & 2 deletions test/react-web/client/graphql/queries.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="jest" />

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';
Expand Down Expand Up @@ -1603,7 +1604,7 @@ describe('queries', () => {
}

(ContextContainer as any).childContextTypes = {
color: React.PropTypes.string,
color: PropTypes.string,
};

let count = 0;
Expand All @@ -1622,7 +1623,7 @@ describe('queries', () => {
}

(ChildContextContainer as any).contextTypes = {
color: React.PropTypes.string,
color: PropTypes.string,
};

renderer.create(
Expand Down
3 changes: 2 additions & 1 deletion test/react-web/server/index.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -571,7 +572,7 @@ describe('SSR', () => {
}

(MyRootContainer as any).childContextTypes = {
color: React.PropTypes.string,
color: PropTypes.string,
};

const app = (
Expand Down