Skip to content

Commit b0c39e2

Browse files
mjacksonMichael Jackson
authored andcommitted
Remove prop type guessing code
1 parent 98112fe commit b0c39e2

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

modules/createContext.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,10 @@ import React from "react";
22
import PropTypes from "prop-types";
33
import warning from "warning";
44

5-
const valueTypes = {
6-
string: PropTypes.string,
7-
number: PropTypes.number,
8-
function: PropTypes.func,
9-
boolean: PropTypes.bool
10-
};
11-
12-
// TODO: This could probably be improved.
13-
function getPropType(value) {
14-
const type = typeof value;
15-
16-
if (type === "object") {
17-
return Array.isArray(value) ? PropTypes.array : PropTypes.object;
18-
}
19-
20-
return valueTypes[type] || PropTypes.any;
21-
}
22-
235
// TODO: Swap this out for Symbol once we don't need a shim for it.
246
let uid = 1;
257

268
function createContext(defaultValue) {
27-
const valueType = getPropType(defaultValue);
289
const channel = uid++;
2910

3011
/**
@@ -54,7 +35,7 @@ function createContext(defaultValue) {
5435

5536
static propTypes = {
5637
children: PropTypes.node,
57-
value: valueType
38+
value: PropTypes.any
5839
};
5940

6041
static defaultProps = {

0 commit comments

Comments
 (0)