Skip to content

Commit fa5d68a

Browse files
committed
Convert React imports to use the recommended import syntax
Doing so prevents any named imports leaking into the output type definitions (.d.ts files) and follows with what seems to be the React official recommendations [1]. The more 'correct' fix would be only import those components that are needed by each component, but that's a bigger change. [1] facebook/react#18102 Fixes stripe#569
1 parent a019e25 commit fa5d68a

11 files changed

+14
-11
lines changed

src/components/CheckoutProvider.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {StrictMode} from 'react';
1+
import * as React from 'react';
2+
import {StrictMode} from 'react';
23
import {render, act, waitFor} from '@testing-library/react';
34
import {renderHook} from '@testing-library/react-hooks';
45

src/components/CheckoutProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {FunctionComponent, PropsWithChildren, ReactNode} from 'react';
22
import * as stripeJs from '@stripe/stripe-js';
33

4-
import React from 'react';
4+
import * as React from 'react';
55
import PropTypes from 'prop-types';
66

77
import {parseStripeProp} from '../utils/parseStripeProp';

src/components/Elements.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {StrictMode} from 'react';
1+
import * as React from 'react';
2+
import {StrictMode} from 'react';
23
import {render, act} from '@testing-library/react';
34
import {renderHook} from '@testing-library/react-hooks';
45

src/components/Elements.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'react';
88
import * as stripeJs from '@stripe/stripe-js';
99

10-
import React from 'react';
10+
import * as React from 'react';
1111
import PropTypes from 'prop-types';
1212

1313
import {usePrevious} from '../utils/usePrevious';

src/components/EmbeddedCheckout.client.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import {render, act} from '@testing-library/react';
33

44
import * as EmbeddedCheckoutProviderModule from './EmbeddedCheckoutProvider';

src/components/EmbeddedCheckout.server.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @jest-environment node
33
*/
44

5-
import React from 'react';
5+
import * as React from 'react';
66
import {renderToString} from 'react-dom/server';
77

88
import * as EmbeddedCheckoutProviderModule from './EmbeddedCheckoutProvider';

src/components/EmbeddedCheckout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import {useEmbeddedCheckoutContext} from './EmbeddedCheckoutProvider';
33
import {isServer} from '../utils/isServer';
44

src/components/EmbeddedCheckoutProvider.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import * as React from 'react';
22
import {render, act} from '@testing-library/react';
33
import {renderHook} from '@testing-library/react-hooks';
44

src/components/EmbeddedCheckoutProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {FunctionComponent, PropsWithChildren, ReactNode} from 'react';
2-
import React from 'react';
2+
import * as React from 'react';
33

44
import {usePrevious} from '../utils/usePrevious';
55
import {UnknownOptions} from '../utils/extractAllowedOptionsUpdates';

src/components/createElementComponent.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {StrictMode} from 'react';
1+
import * as React from 'react';
2+
import {StrictMode} from 'react';
23
import {render, act, waitFor} from '@testing-library/react';
34

45
import * as ElementsModule from './Elements';

src/components/createElementComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {FunctionComponent} from 'react';
33
import * as stripeJs from '@stripe/stripe-js';
44

5-
import React from 'react';
5+
import * as React from 'react';
66

77
import PropTypes from 'prop-types';
88

0 commit comments

Comments
 (0)