From 27acfc741a6c210505be9ee471a3ffdf3f2412bc Mon Sep 17 00:00:00 2001 From: Tanguy Krotoff Date: Sun, 18 Jun 2017 15:46:29 +0200 Subject: [PATCH] Change require('react') to import * as React from 'react' --- types/alt/index.d.ts | 2 +- types/fluxxor/fluxxor-tests.ts | 4 ++-- types/jsnox/index.d.ts | 2 +- types/jsnox/jsnox-tests.ts | 4 ++-- types/radium/index.d.ts | 3 +-- types/rc-select/rc-select-tests.ts | 4 ++-- .../react-addons-shallow-compare-tests.tsx | 4 ++-- .../react-autosuggest-tests.tsx | 6 +++--- types/react-body-classname/index.d.ts | 2 +- .../react-body-classname-tests.tsx | 4 ++-- types/react-cropper/index.d.ts | 4 ++-- .../react-dnd-html5-backend-tests.ts | 4 ++-- types/react-dnd/react-dnd-tests.ts | 4 ++-- types/react-fontawesome/index.d.ts | 3 +-- types/react-highlight-words/index.d.ts | 2 +- .../react-highlight-words-tests.tsx | 2 +- types/react-joyride/index.d.ts | 2 +- types/react-joyride/react-joyride-tests.tsx | 2 +- .../react-recaptcha/react-recaptcha-tests.tsx | 4 ++-- types/react-side-effect/index.d.ts | 2 +- types/react-sortable-hoc/index.d.ts | 2 +- .../react-sortable-hoc-tests.tsx | 6 +++--- types/react-tabs/react-tabs-tests.ts | 4 ++-- .../react-test-renderer-tests.ts | 2 +- .../react-user-tour/react-user-tour-tests.tsx | 4 ++-- types/react/test/index.ts | 20 +++++++++---------- types/react/test/tsx.tsx | 2 +- 27 files changed, 51 insertions(+), 53 deletions(-) diff --git a/types/alt/index.d.ts b/types/alt/index.d.ts index f0ea3ba008..618f70faef 100644 --- a/types/alt/index.d.ts +++ b/types/alt/index.d.ts @@ -141,7 +141,7 @@ declare module "alt/utils/chromeDebug" { declare module "alt/AltContainer" { - import React = require("react"); + import * as React from "react"; interface ContainerProps { store?:AltJS.AltStore; diff --git a/types/fluxxor/fluxxor-tests.ts b/types/fluxxor/fluxxor-tests.ts index ef6a8c707a..38522b1e1b 100644 --- a/types/fluxxor/fluxxor-tests.ts +++ b/types/fluxxor/fluxxor-tests.ts @@ -1,5 +1,5 @@ -import React = require('react'); -import Fluxxor = require('fluxxor'); +import * as React from 'react'; +import * as Fluxxor from 'fluxxor'; class DispatcherTest { v: Fluxxor.Dispatcher; diff --git a/types/jsnox/index.d.ts b/types/jsnox/index.d.ts index ac9b09b700..6adce0e43c 100644 --- a/types/jsnox/index.d.ts +++ b/types/jsnox/index.d.ts @@ -6,7 +6,7 @@ /// -import React = require("react"); +import * as React from "react"; /* * JSnoX requires an object with a createElement method. diff --git a/types/jsnox/jsnox-tests.ts b/types/jsnox/jsnox-tests.ts index 8323a6c562..26014b362f 100644 --- a/types/jsnox/jsnox-tests.ts +++ b/types/jsnox/jsnox-tests.ts @@ -1,6 +1,6 @@ -import React = require('react'); -import jsnox = require('jsnox'); +import * as React from 'react'; +import * as jsnox from 'jsnox'; var $ = jsnox(React); interface PersonProps { diff --git a/types/radium/index.d.ts b/types/radium/index.d.ts index 58f9045923..e80794b129 100644 --- a/types/radium/index.d.ts +++ b/types/radium/index.d.ts @@ -4,8 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import React = require('react'); -import ReactComponent = React.Component; +import * as React from 'react'; export = Radium; diff --git a/types/rc-select/rc-select-tests.ts b/types/rc-select/rc-select-tests.ts index 976d789c2c..f3512da1c9 100644 --- a/types/rc-select/rc-select-tests.ts +++ b/types/rc-select/rc-select-tests.ts @@ -1,5 +1,5 @@ -import React = require('react'); -import RcSelect = require('rc-select'); +import * as React from 'react'; +import * as RcSelect from 'rc-select'; class Component extends React.Component { diff --git a/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx b/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx index 6d4b9e7013..f967eb2350 100644 --- a/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx +++ b/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx @@ -1,5 +1,5 @@ -import React = require('react'); -import shallowCompare = require('react-addons-shallow-compare'); +import * as React from 'react'; +import * as shallowCompare from 'react-addons-shallow-compare'; export class MyComponent extends React.Component<{}, {}> { shouldComponentUpdate(nextProps: any, nextState: any, nextContext: any): boolean { diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index 1488163ba0..dc1859392b 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -1,7 +1,7 @@ // region Imports -import React = require('react'); -import ReactDOM = require('react-dom'); -import Autosuggest = require('react-autosuggest'); +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as Autosuggest from 'react-autosuggest'; // endregion interface Language { diff --git a/types/react-body-classname/index.d.ts b/types/react-body-classname/index.d.ts index b7f0856df9..0b796e1f0f 100644 --- a/types/react-body-classname/index.d.ts +++ b/types/react-body-classname/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import React = require("react"); +import * as React from "react"; export = BodyClassName; diff --git a/types/react-body-classname/react-body-classname-tests.tsx b/types/react-body-classname/react-body-classname-tests.tsx index 019105bee6..c59e438a86 100644 --- a/types/react-body-classname/react-body-classname-tests.tsx +++ b/types/react-body-classname/react-body-classname-tests.tsx @@ -1,5 +1,5 @@ -import React = require("react"); -import BodyClassName = require("react-body-classname"); +import * as React from "react"; +import BodyClassName = require("react-body-classname"); class SomeComponent { render() { diff --git a/types/react-cropper/index.d.ts b/types/react-cropper/index.d.ts index a9c6ba5b24..f707da0014 100644 --- a/types/react-cropper/index.d.ts +++ b/types/react-cropper/index.d.ts @@ -4,8 +4,8 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import cropperjs = require('cropperjs'); -import React = require("react"); +import * as cropperjs from 'cropperjs'; +import * as React from 'react'; import Data = cropperjs.Data; import ContainerData = cropperjs.ContainerData; diff --git a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts b/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts index 198909b7e9..4ca6adfa32 100644 --- a/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts +++ b/types/react-dnd-html5-backend/react-dnd-html5-backend-tests.ts @@ -1,8 +1,8 @@ // Test adapted from the ReactDnD chess game tutorial: // http://gaearon.github.io/react-dnd/docs-tutorial.html -import React = require("react"); -import ReactDnd = require("react-dnd"); +import * as React from "react"; +import * as ReactDnd from "react-dnd"; const r = React.DOM; diff --git a/types/react-dnd/react-dnd-tests.ts b/types/react-dnd/react-dnd-tests.ts index 0aabefd26e..7ba80e36c2 100644 --- a/types/react-dnd/react-dnd-tests.ts +++ b/types/react-dnd/react-dnd-tests.ts @@ -1,8 +1,8 @@ // Test adapted from the ReactDnD chess game tutorial: // http://gaearon.github.io/react-dnd/docs-tutorial.html -import React = require("react"); -import ReactDnd = require("react-dnd"); +import * as React from "react"; +import * as ReactDnd from "react-dnd"; var r = React.DOM; diff --git a/types/react-fontawesome/index.d.ts b/types/react-fontawesome/index.d.ts index d866eddfad..28b401d366 100644 --- a/types/react-fontawesome/index.d.ts +++ b/types/react-fontawesome/index.d.ts @@ -6,8 +6,7 @@ declare module "react-fontawesome" { - //Import react - import React = require('react'); + import * as React from 'react'; type FontAwesomeSize = 'lg' | '2x' | '3x' | '4x' | '5x'; type FontAwesomeStack = "1x" | "2x"; diff --git a/types/react-highlight-words/index.d.ts b/types/react-highlight-words/index.d.ts index 220c245638..dc1186e9ea 100644 --- a/types/react-highlight-words/index.d.ts +++ b/types/react-highlight-words/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -import React = require("react"); +import * as React from "react"; export = Highlighter; diff --git a/types/react-highlight-words/react-highlight-words-tests.tsx b/types/react-highlight-words/react-highlight-words-tests.tsx index 51d1f82374..a63e9b877b 100644 --- a/types/react-highlight-words/react-highlight-words-tests.tsx +++ b/types/react-highlight-words/react-highlight-words-tests.tsx @@ -1,4 +1,4 @@ -import React = require("react"); +import * as React from "react"; import Highlighter = require("react-highlight-words"); { constructor(props: Props); diff --git a/types/react-joyride/react-joyride-tests.tsx b/types/react-joyride/react-joyride-tests.tsx index e17745b893..b5658bda95 100644 --- a/types/react-joyride/react-joyride-tests.tsx +++ b/types/react-joyride/react-joyride-tests.tsx @@ -1,4 +1,4 @@ -import React = require("react"); +import * as React from "react"; import Joyride, { Step } from "react-joyride"; class NewComponent extends React.Component { diff --git a/types/react-recaptcha/react-recaptcha-tests.tsx b/types/react-recaptcha/react-recaptcha-tests.tsx index d931e45ae3..98f3972c00 100644 --- a/types/react-recaptcha/react-recaptcha-tests.tsx +++ b/types/react-recaptcha/react-recaptcha-tests.tsx @@ -1,6 +1,6 @@ import Recaptcha = require('react-recaptcha'); -import ReactDOM = require("react-dom"); -import React = require("react"); +import * as ReactDOM from "react-dom"; +import * as React from "react"; ReactDOM.render( any, diff --git a/types/react-sortable-hoc/index.d.ts b/types/react-sortable-hoc/index.d.ts index 1ae88e258a..04ba275c7e 100644 --- a/types/react-sortable-hoc/index.d.ts +++ b/types/react-sortable-hoc/index.d.ts @@ -5,7 +5,7 @@ // TypeScript Version: 2.1 declare module 'react-sortable-hoc' { - import React = require('react'); + import * as React from 'react'; export type Axis = 'x' | 'y' | 'xy'; diff --git a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx index 9bdb082ab2..c1f824adeb 100644 --- a/types/react-sortable-hoc/react-sortable-hoc-tests.tsx +++ b/types/react-sortable-hoc/react-sortable-hoc-tests.tsx @@ -1,6 +1,6 @@ -import React = require('react'); -import ReactDOM = require('react-dom'); -import ReactSortableHOC = require('react-sortable-hoc'); +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import * as ReactSortableHOC from 'react-sortable-hoc'; interface SortableItemProps { value: string; diff --git a/types/react-tabs/react-tabs-tests.ts b/types/react-tabs/react-tabs-tests.ts index 9059896044..cdbeeeb010 100644 --- a/types/react-tabs/react-tabs-tests.ts +++ b/types/react-tabs/react-tabs-tests.ts @@ -1,5 +1,5 @@ -import React = require("react"); -import ReactDOM = require("react-dom"); +import * as React from "react"; +import * as ReactDOM from "react-dom"; import { Tabs, TabList, Tab, TabPanel, resetIdCounter } from "react-tabs"; resetIdCounter(); diff --git a/types/react-test-renderer/react-test-renderer-tests.ts b/types/react-test-renderer/react-test-renderer-tests.ts index c93b27e0b2..93c8661923 100644 --- a/types/react-test-renderer/react-test-renderer-tests.ts +++ b/types/react-test-renderer/react-test-renderer-tests.ts @@ -1,4 +1,4 @@ -import React = require("react"); +import * as React from "react"; import { create } from "react-test-renderer"; import { createRenderer } from 'react-test-renderer/shallow'; diff --git a/types/react-user-tour/react-user-tour-tests.tsx b/types/react-user-tour/react-user-tour-tests.tsx index 35b8067f55..c961ee5bbd 100644 --- a/types/react-user-tour/react-user-tour-tests.tsx +++ b/types/react-user-tour/react-user-tour-tests.tsx @@ -5,8 +5,8 @@ /// -import React = require('react'); -import ReactDOM = require('react-dom'); +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; import ReactUserTour from 'react-user-tour'; diff --git a/types/react/test/index.ts b/types/react/test/index.ts index fc042d881c..a8bdf62acf 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -1,14 +1,14 @@ -import React = require("react"); -import ReactDOM = require("react-dom"); -import ReactDOMServer = require("react-dom/server"); +import * as React from "react"; +import * as ReactDOM from "react-dom"; +import * as ReactDOMServer from "react-dom/server"; import createFragment = require("react-addons-create-fragment"); -import CSSTransitionGroup = require("react-addons-css-transition-group"); -import LinkedStateMixin = require("react-addons-linked-state-mixin"); -import Perf = require("react-addons-perf"); -import PureRenderMixin = require("react-addons-pure-render-mixin"); -import shallowCompare = require("react-addons-shallow-compare"); -import TestUtils = require("react-addons-test-utils"); -import TransitionGroup = require("react-addons-transition-group"); +import * as CSSTransitionGroup from "react-addons-css-transition-group"; +import * as LinkedStateMixin from "react-addons-linked-state-mixin"; +import * as Perf from "react-addons-perf"; +import * as PureRenderMixin from "react-addons-pure-render-mixin"; +import * as shallowCompare from "react-addons-shallow-compare"; +import * as TestUtils from "react-addons-test-utils"; +import * as TransitionGroup from "react-addons-transition-group"; import update = require("react-addons-update"); interface Props extends React.Attributes { diff --git a/types/react/test/tsx.tsx b/types/react/test/tsx.tsx index 1d6b683bcf..59c00202b3 100644 --- a/types/react/test/tsx.tsx +++ b/types/react/test/tsx.tsx @@ -1,4 +1,4 @@ -import React = require("react"); +import * as React from "react"; interface SCProps { foo?: number;