From 83e41109d6482ba765ff3e25df8fda59104aa046 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 | 3 ++- .../mods/componentToCompat/componentToCompat.mod.ts | 10 ++++++++-- .../src/modRunner/tests/mocks/MockMods/CodeMod.mock.ts | 5 +++-- syncpack.config.js | 5 +++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/packages/codemods/package.json b/packages/codemods/package.json index 1db4b8f33dea6..652fc136248e2 100644 --- a/packages/codemods/package.json +++ b/packages/codemods/package.json @@ -25,7 +25,8 @@ "devDependencies": { "@fluentui/eslint-plugin": "*", "@fluentui/scripts-jest": "*", - "@fluentui/scripts-tasks": "*" + "@fluentui/scripts-tasks": "*", + "typescript": "5.3.3" }, "dependencies": { "tslib": "^2.1.0", 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: [] }); }, diff --git a/syncpack.config.js b/syncpack.config.js index 4618b062fcb92..6a9c401c68581 100644 --- a/syncpack.config.js +++ b/syncpack.config.js @@ -26,6 +26,11 @@ const config = { dependencies: ['@fluentui/**'], isIgnored: true, }, + { + packages: ['@fluentui/codemods'], + dependencies: ['typescript'], + isIgnored: true, + }, { packages: ['@fluentui/fluentui-repo'], dependencies: [