You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .changeset/chilled-oranges-sit.md
+3-9Lines changed: 3 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,15 +4,15 @@
4
4
5
5
Ensure added imports of types use the `type` modifier
6
6
7
-
If we'd previously add an import to `ReactNode` (e.g. in `deprecated-react-fragment`),
7
+
If we'd previously add an import to `JSX` (e.g. in `scoped-jsx`),
8
8
the codemod would import it as a value.
9
9
This breaks TypeScript projects using `verbatimModuleSyntax` as well as projects enforcing `type` imports for types.
10
10
11
11
Now we ensure new imports of types use the `type` modifier:
12
12
13
13
```diff
14
-
-import { ReactNode } from 'react'
15
-
+import { type ReactNode } from 'react'
14
+
-import { JSX } from 'react'
15
+
+import { type JSX } from 'react'
16
16
```
17
17
18
18
This also changes how we transform the deprecated global JSX namespace.
@@ -41,10 +41,4 @@ Note that rewriting of imports does not change the modifier.
41
41
For example, the `deprecated-vfc-codemod` rewrites `VFC` identifiers to `FC`.
42
42
If the import of `VFC` had no `type` modifier, the codemod will not add one.
43
43
44
-
This affects the following codemods:
45
-
46
-
-`deprecated-react-fragment`
47
-
-`deprecated-react-node-array`
48
-
-`scoped-jsx`
49
-
50
44
`type` modifiers for import specifiers require [TypeScript 4.5 which has reached EOL](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window in DefinitelyTyped) which is a strong signal that you should upgrade to at least TypeScript 4.6 by now.
0 commit comments