codemod icon indicating copy to clipboard operation
codemod copied to clipboard

[codemod request] types-react: remove deprecated ReactHTML and ReactSVG

Open alexbit-codemod opened this issue 1 year ago • 2 comments

on behalf of eps1lon:

" ReactHMTL and ReactSVG were related to createFactories but we found usage using it as a list of possible built-in browser element types.

We now have HTMLElementType and SVGElementType which can be used instead of keyof ReactHTML and keyof ReactSVG respectively.

Needs real world codebase with usage to test on."

Note: The example section helps codemod contributors identify all the transformation patterns that this codemod should handle. Repeat before/after snippets for every transformation example you can find.

Code before transformation

//insert your code before transformation here

Code after transformation

//insert the expected **correct** output here

Applicability Criteria

Which types-react versions include the deprecated pattern?

Additional context or links

Add any other context about the problem here. This might include extra considerations, edge cases, relevant business logic, existing migration guides, relevant links, etc.

alexbit-codemod avatar May 19 '24 04:05 alexbit-codemod

@alexbit-codemod the current react-beta guide doesn't have a mention of this? "ReactHMTL and ReactSVG were related to createFactories but we found usage using it as a list of possible built-in browser element types."

arshcodemod avatar May 21 '24 10:05 arshcodemod

Okay we tried again and got this codemod. It fixed the import statement, but the tag is not fixed.

We followed @arybitskiy's suggestions shown here and here.

mohab-sameh avatar May 21 '24 11:05 mohab-sameh