Skip to content

Commit 37b8951

Browse files
committed
[state-router] Import * triggers a deprecation warning, so use import type instead
1 parent 34cdb2e commit 37b8951

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

packages/@sanity/state-router/src/components/IntentLink.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow
2-
import * as React from 'react'
2+
import React from 'react'
3+
import type {Node} from 'react'
34
import Link from './Link'
45
import type {RouterProviderContext} from './types'
56
import internalRouterContextTypeCheck from './internalRouterContextTypeCheck'
@@ -8,7 +9,7 @@ export default class IntentLink extends React.PureComponent<*, *> {
89
props: {
910
intent: string,
1011
params?: Object,
11-
children: React.Node,
12+
children: Node,
1213
className: string
1314
};
1415

packages/@sanity/state-router/src/components/Link.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// @flow
2-
import * as React from 'react'
2+
import React from 'react'
33
import {omit} from 'lodash'
44
import type {RouterProviderContext} from './types'
55
import internalRouterContextTypeCheck from './internalRouterContextTypeCheck'

packages/@sanity/state-router/src/components/RouteScope.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// @flow
22
import PropTypes from 'prop-types'
3-
import * as React from 'react'
3+
import React from 'react'
44
import isEmpty from '../utils/isEmpty'
55

6+
import type {Node} from 'react'
67
import type {RouterProviderContext, NavigateOptions, InternalRouter} from './types'
78

89
function addScope(routerState: Object, scope: string, scopedState: Object) {
@@ -14,7 +15,7 @@ function addScope(routerState: Object, scope: string, scopedState: Object) {
1415

1516
type Props = {
1617
scope: string,
17-
children: React.Node
18+
children: Node
1819
}
1920

2021
export default class RouteScope extends React.Component<*, *> {

packages/@sanity/state-router/src/components/RouterProvider.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
// @flow
2-
import * as React from 'react'
2+
import React from 'react'
33
import PropTypes from 'prop-types'
4+
import pubsub from 'nano-pubsub'
5+
import type {Node} from 'react'
46
import type {Router} from '../types'
57
import type {RouterProviderContext, NavigateOptions, InternalRouter, RouterState} from './types'
6-
import pubsub from 'nano-pubsub'
78

89
type Props = {
910
onNavigate: (nextPath: string, options?: NavigateOptions) => void,
1011
router: Router,
1112
state: RouterState,
12-
children: React.Node
13+
children: Node
1314
}
1415

1516
export default class RouterProvider extends React.Component<*, *> {

packages/@sanity/state-router/src/components/WithRouter.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// @flow
2-
import * as React from 'react'
3-
import type {Router} from './types'
2+
import React from 'react'
43
import withRouterHOC from './withRouterHOC'
4+
import type {Router} from './types'
5+
import type {Node} from 'react'
56

67
type Props = {
78
router: Router,
8-
children: (Router) => React.Node
9+
children: (Router) => Node
910
}
1011

1112
const WithRouter = withRouterHOC((props: Props) => props.children(props.router))

packages/@sanity/state-router/src/components/withRouterHOC.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// @flow
2-
import * as React from 'react'
3-
import type {Router, InternalRouter} from './types'
2+
import React from 'react'
43
import internalRouterContextTypeCheck from './internalRouterContextTypeCheck'
4+
import type {Router, InternalRouter} from './types'
5+
import type {ComponentType} from 'react'
56

67
type State = {
78
routerState: Object
@@ -17,7 +18,7 @@ const NO_CONTEXT_STATE = {
1718
}
1819
}
1920

20-
export default function withRouter<Props: {}>(Component: React.ComponentType<{ router: Router } & Props>): React.ComponentType<Props> {
21+
export default function withRouter<Props: {}>(Component: ComponentType<{ router: Router } & Props>): ComponentType<Props> {
2122

2223
return class extends React.Component<*, *> {
2324
static displayName = `withRouter(${Component.displayName || Component.name})`

0 commit comments

Comments
 (0)