@@ -34,9 +34,10 @@ $ npx types-react-codemod --help
34
34
types-react-codemod < codemod> < paths...>
35
35
36
36
Positionals:
37
- codemod [string] [required] [choices: " context-any" , " deprecated-react-type" ,
38
- " deprecated-sfc-element" , " deprecated-sfc" , " deprecated-stateless-component" ,
39
- " implicit-children" , " preset-18" , " useCallback-implicit-any" ]
37
+ codemod [string] [required] [choices: " context-any" , " deprecated-react-text" ,
38
+ " deprecated-react-type" , " deprecated-sfc-element" , " deprecated-sfc" ,
39
+ " deprecated-stateless-component" , " implicit-children" , " preset-18" ,
40
+ " preset-19" , " useCallback-implicit-any" ]
40
41
paths [string] [required]
41
42
42
43
Options:
@@ -67,6 +68,8 @@ The reason being that a false-positive can be reverted easily (assuming you have
67
68
- ` context-any `
68
69
- ` implicit-children `
69
70
- ` useCallback-implicit-any `
71
+ - ` preset-19 `
72
+ - ` deprecated-react-text `
70
73
71
74
### ` preset-18 `
72
75
@@ -193,3 +196,33 @@ type CreateCallback = () => (event: Event) => void;
193
196
- const createCallback: CreateCallback = () => useCallback((event) => {}, [])
194
197
+ const createCallback: CreateCallback = () => useCallback((event: any) => {}, [])
195
198
```
199
+
200
+ ### ` preset-19 `
201
+
202
+ This codemod combines all codemods for React 19 types.
203
+ You can interactively pick the codemods included.
204
+ By default, the codemods that are definitely required to upgrade to ` @types/react@^19.0.0 ` are selected.
205
+ The other codemods may or may not be required.
206
+ You should select all and audit the changed files regardless.
207
+
208
+ ### ` deprecated-react-text `
209
+
210
+ ``` diff
211
+ import * as React from "react";
212
+ interface Props {
213
+ - label?: React.ReactText;
214
+ + label?: number | string;
215
+ }
216
+ ```
217
+
218
+ #### ` deprecated-react-text ` false-negative pattern A
219
+
220
+ Importing ` ReactText ` via aliased named import will result in the transform being skipped.
221
+
222
+ ``` tsx
223
+ import { ReactText as MyReactText } from " react" ;
224
+ interface Props {
225
+ // not transformed
226
+ label? : MyReactText ;
227
+ }
228
+ ```
0 commit comments