From a00c17ba3dab85f7efcb8883ecec05c44637bda3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Fri, 22 Mar 2024 10:13:44 +0000 Subject: [PATCH] chore: upgrade typescript in frontend to 5.4.2 (#6673) Follow up to https://github.com/Unleash/unleash/pull/6605 This upgrades TypeScript in frontend to `5.4.2`, matching the version we have on the server. Only 2 things broke with this upgrade, so the changes are related to fixing the types in those places. This fixes https://github.com/Unleash/unleash/pull/6659 --- frontend/package.json | 2 +- .../change-request-conflict-data.test.ts | 5 +++-- .../change-request-conflict-data.ts | 15 +-------------- frontend/src/utils/strategyNames.tsx | 4 ++-- frontend/yarn.lock | 8 ++++---- 5 files changed, 11 insertions(+), 23 deletions(-) diff --git a/frontend/package.json b/frontend/package.json index 13f422c7f7..44650444d1 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -113,7 +113,7 @@ "semver": "7.6.0", "swr": "2.2.5", "tss-react": "4.9.4", - "typescript": "4.8.4", + "typescript": "5.4.2", "use-query-params": "^2.2.1", "vanilla-jsoneditor": "^0.23.0", "vite": "5.1.6", diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.test.ts b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.test.ts index 411b27b804..53e9c1c224 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.test.ts +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.test.ts @@ -3,6 +3,7 @@ import { getChangeRequestConflictCreatedData, getChangeRequestConflictCreatedDataFromScheduleData, } from './change-request-conflict-data'; +import type { ChangeRequestType } from 'component/changeRequest/changeRequest.types'; const uiConfig: Pick = { baseUriPath: '/some-base-uri', @@ -58,7 +59,7 @@ const changeRequestWithoutStrategy = { test('it finds crs that update a strategy', () => { const results = getChangeRequestConflictCreatedData( - [changeRequestWithStrategy], + [changeRequestWithStrategy] as ChangeRequestType[], featureId, strategyId, uiConfig, @@ -74,7 +75,7 @@ test('it finds crs that update a strategy', () => { test('it does not return crs that do not update a strategy', () => { const results = getChangeRequestConflictCreatedData( - [changeRequestWithoutStrategy], + [changeRequestWithoutStrategy] as ChangeRequestType[], featureId, strategyId, uiConfig, diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.ts b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.ts index 58474b431b..137b576b4c 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.ts +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyEdit/change-request-conflict-data.ts @@ -1,8 +1,6 @@ import type { ChangeRequestState, ChangeRequestType, - IChangeRequestFeature, - IFeatureChange, } from 'component/changeRequest/changeRequest.types'; import type { ScheduledChangeRequestViewModel } from 'hooks/api/getters/useScheduledChangeRequestsWithStrategy/useScheduledChangeRequestsWithStrategy'; import type { IUiConfig } from 'interfaces/uiConfig'; @@ -14,18 +12,7 @@ type ChangeRequestConflictCreatedData = { }; export const getChangeRequestConflictCreatedData = ( - changeRequests: - | { - state: ChangeRequestType['state']; - id: ChangeRequestType['id']; - features: { - name: IChangeRequestFeature['name']; - changes: (Pick & { - payload: { id?: number | string }; - })[]; - }[]; - }[] - | undefined, + changeRequests: ChangeRequestType[] | undefined, featureId: string, strategyId: string, uiConfig: Pick, diff --git a/frontend/src/utils/strategyNames.tsx b/frontend/src/utils/strategyNames.tsx index 999ada5c6d..5b9eb52bb5 100644 --- a/frontend/src/utils/strategyNames.tsx +++ b/frontend/src/utils/strategyNames.tsx @@ -1,4 +1,4 @@ -import type { FC } from 'react'; +import type { FC, SVGProps } from 'react'; import { SvgIcon, useTheme } from '@mui/material'; import LocationOnIcon from '@mui/icons-material/LocationOn'; import PeopleIcon from '@mui/icons-material/People'; @@ -14,7 +14,7 @@ export const formatStrategyName = (strategyName: string): string => { const RolloutSvgIcon: FC = (props) => ( } + component={(rest: SVGProps) => } inheritViewBox /> ); diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 38993289eb..7b0fd0e42f 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -7002,10 +7002,10 @@ typed-array-length@^1.0.5: is-typed-array "^1.1.13" possible-typed-array-names "^1.0.0" -typescript@4.8.4: - version "4.8.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.4.tgz#c464abca159669597be5f96b8943500b238e60e6" - integrity sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ== +typescript@5.4.2: + version "5.4.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.2.tgz#0ae9cebcfae970718474fe0da2c090cad6577372" + integrity sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ== uc.micro@^1.0.1: version "1.0.6"