diff --git a/.gitignore b/.gitignore
index 7a4000d195..bd213e9caf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,4 @@ junit.xml
/src/icons/filled/material
/src/icons/outlined/material
cypress/config/a11y-components.json
+lib/codemod/.eslintcache
diff --git a/lib/codemod/README.md b/lib/codemod/README.md
index fd55c241d1..2472eb3d49 100644
--- a/lib/codemod/README.md
+++ b/lib/codemod/README.md
@@ -26,6 +26,7 @@ The list includes these transformers
- [`emotion-icons`](#emotion-icons)
- [`remove-redundant-marker-ul`](#remove-redundant-marker-ul)
- [`update-list-item-marker-ul-value`](#update-list-item-marker-ul-value)
+- [`enum-to-union`](#enum-to-union)
#### `emotion-icons`
@@ -61,6 +62,14 @@ Unordered List has now a default marker, the script passes `listItemMarker` with
-
+
```
+#### `enum-to-union`
+
+Some of NewsKit components support enum as the prop type, the script remove the imports of enum and replace enum type with union type.
+
+```diff
+-
++
+```
diff --git a/lib/codemod/src/cli.js b/lib/codemod/src/cli.js
index f1960cb746..7cf78a3d8f 100755
--- a/lib/codemod/src/cli.js
+++ b/lib/codemod/src/cli.js
@@ -18,6 +18,8 @@ const TRANSFORMS = {
'Unordered List has now a default marker, removes the prop passing the same icon now set as default.',
'update-list-item-marker-ul-value':
'Unordered List has now a default marker, the script passes "listItemMarker" with a value of "null" to UnorderedList components originally not passing any marker.',
+ 'enum-to-union':
+ 'Replace enum type with union type and remove the imports of enums',
};
function expandFilePathsIfNeeded(filesBeforeExpansion) {
diff --git a/lib/codemod/src/transforms/__tests__/enums-to-union/actual.js b/lib/codemod/src/transforms/__tests__/enums-to-union/actual.js
new file mode 100644
index 0000000000..64ecc593db
--- /dev/null
+++ b/lib/codemod/src/transforms/__tests__/enums-to-union/actual.js
@@ -0,0 +1,88 @@
+import {
+ Button,
+ IconButton,
+ ButtonSize,
+ MenuItemAlign,
+ MenuItemSize,
+ Menu,
+ MenuItem,
+ Slider,
+ LabelPosition,
+ Stack,
+ Flow,
+ StackDistribution,
+ StackChild,
+ AlignSelfValues,
+ TagSize,
+ Tabs,
+ Tab,
+ TabAlign,
+ TabsIndicatorPosition,
+ TabSize,
+ TabsDistribution,
+ FormInput,
+ FormInputTextField,
+ TextFieldSize,
+ TextInputSize,
+} from 'newskit';
+
+const Component = () => (
+ <>
+
+
+