From ea576b04d0b4d0adbd7ecdf9375a98232771b419 Mon Sep 17 00:00:00 2001 From: mainframev Date: Fri, 20 Dec 2024 18:08:05 +0100 Subject: [PATCH] chore(codemods): fix issues related to ts 5.5 upgrade --- packages/codemods/package.json | 1 + .../mods/componentToCompat/componentToCompat.mod.ts | 10 ++++++++-- .../src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/codemods/package.json b/packages/codemods/package.json index 1db4b8f33dea6..a53ee31d013b3 100644 --- a/packages/codemods/package.json +++ b/packages/codemods/package.json @@ -31,6 +31,7 @@ "tslib": "^2.1.0", "react": "17.0.2", "ts-morph": "^10.0.1", + "typescript": "5.3.3", "glob": "^7.1.2", "yargs": "^13.3.2" } diff --git a/packages/codemods/src/codeMods/mods/componentToCompat/componentToCompat.mod.ts b/packages/codemods/src/codeMods/mods/componentToCompat/componentToCompat.mod.ts index 417776016eda5..140a903ca4226 100644 --- a/packages/codemods/src/codeMods/mods/componentToCompat/componentToCompat.mod.ts +++ b/packages/codemods/src/codeMods/mods/componentToCompat/componentToCompat.mod.ts @@ -1,4 +1,10 @@ -import { runComponentToCompat, buildCompatHash, ComponentToCompat, RawCompat, getNamedExports } from './compatHelpers'; +import { + runComponentToCompat, + buildCompatHash, + getNamedExports, + type RawCompat, + type ComponentToCompat as ComponentToCompatType, +} from './compatHelpers'; import { ExportMapping } from './namedExports'; import { CodeMod } from '../../types'; import { SourceFile } from 'ts-morph'; @@ -12,7 +18,7 @@ function getPath(root: string, componentName: string) { return `${root}${componentName}`; } -export function createComponentToCompat(comp: RawCompat): ComponentToCompat { +export function createComponentToCompat(comp: RawCompat): ComponentToCompatType { return { oldPath: getPath(completePath, comp.componentName), newComponentPath: getPath(newPathStart, comp.componentName), diff --git a/packages/codemods/src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts b/packages/codemods/src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts index a7b76fe0eb087..7c02bfab89890 100644 --- a/packages/codemods/src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts +++ b/packages/codemods/src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts @@ -1,6 +1,7 @@ -import { CodeMod, ModResult, NoOp } from '../../../../codeMods/types'; +import { CodeMod as CodeModType, ModResult, NoOp } from '../../../../codeMods/types'; import { Err } from '../../../../helpers/result'; -const CodeMod: CodeMod = { + +const CodeMod: CodeModType = { run: () => { return Err({ logs: [] }); },