From e17e6a84ab6d14d88dff57bea7077463a3058e08 Mon Sep 17 00:00:00 2001 From: evenstensberg Date: Mon, 11 Apr 2016 14:47:02 +0200 Subject: [PATCH] Fixes to PropTypes --- modules/Link.js | 5 +++-- modules/PropTypes.js | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/Link.js b/modules/Link.js index 3c105156ea..91f3b519cb 100644 --- a/modules/Link.js +++ b/modules/Link.js @@ -1,7 +1,8 @@ import React from 'react' import warning from './routerWarning' +import { to } from './PropTypes' -const { bool, object, string, func, oneOfType } = React.PropTypes +const { bool, object, string, func } = React.PropTypes function isLeftClickEvent(event) { return event.button === 0 @@ -53,7 +54,7 @@ const Link = React.createClass({ }, propTypes: { - to: oneOfType([ string, object ]).isRequired, + to: to.isRequired, query: object, hash: string, state: object, diff --git a/modules/PropTypes.js b/modules/PropTypes.js index c22a9726b7..cadcb331c6 100644 --- a/modules/PropTypes.js +++ b/modules/PropTypes.js @@ -26,6 +26,7 @@ export const component = oneOfType([ func, string ]) export const components = oneOfType([ component, object ]) export const route = oneOfType([ object, element ]) export const routes = oneOfType([ route, arrayOf(route) ]) +export const to = oneOfType([ string, object ]) export default { falsy, @@ -33,5 +34,6 @@ export default { location, component, components, - route + route, + to }