From b4488ddb0b87f9a75a1e45572e265c98e0437a04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Wed, 2 Dec 2020 09:38:30 +0100 Subject: [PATCH] address typescript errors --- .changeset/itchy-hotels-brush.md | 9 ++ packages/cli/asset-types/asset-types.d.ts | 12 +++ .../OAuthRequestApi/OAuthPendingRequests.ts | 2 +- .../src/ingestion/processors/util/org.test.ts | 2 +- plugins/cost-insights/src/utils/styles.ts | 82 +++++++++---------- 5 files changed, 61 insertions(+), 46 deletions(-) create mode 100644 .changeset/itchy-hotels-brush.md diff --git a/.changeset/itchy-hotels-brush.md b/.changeset/itchy-hotels-brush.md new file mode 100644 index 0000000000..7f1bb4ef14 --- /dev/null +++ b/.changeset/itchy-hotels-brush.md @@ -0,0 +1,9 @@ +--- +'@backstage/cli': patch +'@backstage/config-loader': patch +'@backstage/core-api': patch +'@backstage/plugin-catalog-backend': patch +'@backstage/plugin-cost-insights': patch +--- + +Added a type alias for PositionError = GeolocationPositionError diff --git a/packages/cli/asset-types/asset-types.d.ts b/packages/cli/asset-types/asset-types.d.ts index 28c1fde9e3..9db4438fd4 100644 --- a/packages/cli/asset-types/asset-types.d.ts +++ b/packages/cli/asset-types/asset-types.d.ts @@ -97,3 +97,15 @@ declare module '*.module.sass' { const classes: { readonly [key: string]: string }; export default classes; } + +// NOTE(freben): Both the fix, and the placement of the fix, are not great. +// +// The fix is because the PositionError was renamed to +// GeolocationPositionError outside of our control, and react-use is dependent +// on the old name. +// +// The placement is because it's the one location we have at the moment, where +// a central .d.ts file is imported by the frontend and can be amended. +// +// After both TS and react-use are bumped high enough, this should be removed. +type PositionError = GeolocationPositionError; diff --git a/packages/core-api/src/apis/implementations/OAuthRequestApi/OAuthPendingRequests.ts b/packages/core-api/src/apis/implementations/OAuthRequestApi/OAuthPendingRequests.ts index 6287f35015..e616ece5ae 100644 --- a/packages/core-api/src/apis/implementations/OAuthRequestApi/OAuthPendingRequests.ts +++ b/packages/core-api/src/apis/implementations/OAuthRequestApi/OAuthPendingRequests.ts @@ -19,7 +19,7 @@ import { Observable } from '../../../types'; type RequestQueueEntry = { scopes: Set; - resolve: (value?: ResultType | PromiseLike | undefined) => void; + resolve: (value: ResultType | PromiseLike) => void; reject: (reason: Error) => void; }; diff --git a/plugins/catalog-backend/src/ingestion/processors/util/org.test.ts b/plugins/catalog-backend/src/ingestion/processors/util/org.test.ts index f7afd63101..7e5a2e9754 100644 --- a/plugins/catalog-backend/src/ingestion/processors/util/org.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/util/org.test.ts @@ -76,7 +76,7 @@ describe('buildMemberOf', () => { const u: UserEntity = { apiVersion: 'backstage.io/v1alpha1', kind: 'User', - metadata: { name }, + metadata: { name: 'n' }, spec: { profile: {}, memberOf: ['c'] }, }; diff --git a/plugins/cost-insights/src/utils/styles.ts b/plugins/cost-insights/src/utils/styles.ts index 5a42604311..c04ceba8e3 100644 --- a/plugins/cost-insights/src/utils/styles.ts +++ b/plugins/cost-insights/src/utils/styles.ts @@ -222,16 +222,13 @@ export const useBarChartLabelStyles = makeStyles(theme => }), ); -export const useCostInsightsStyles = makeStyles( - (theme: BackstageTheme) => - createStyles({ - h6Subtle: { - ...theme.typography.h6, - fontWeight: 'normal', - color: theme.palette.textSubtle, - }, - }), -); +export const useCostInsightsStyles = makeStyles(theme => ({ + h6Subtle: { + ...theme.typography.h6, + fontWeight: 'normal', + color: theme.palette.textSubtle, + }, +})); export const useCostInsightsTabsStyles = makeStyles( (theme: BackstageTheme) => ({ @@ -310,40 +307,37 @@ export const useCostGrowthStyles = makeStyles( }), ); -export const useCostGrowthLegendStyles = makeStyles( - (theme: BackstageTheme) => - createStyles({ - h5: { - ...theme.typography.h5, - fontWeight: 500, - padding: 0, - }, - marker: { - display: 'inherit', - marginRight: theme.spacing(1), - }, - helpIcon: { - display: 'inherit', - }, - title: { - ...theme.typography.overline, - fontWeight: 500, - lineHeight: 0, - marginRight: theme.spacing(1), - color: theme.palette.textSubtle, - }, - tooltip: { - display: 'block', - padding: theme.spacing(1), - backgroundColor: theme.palette.navigation.background, - }, - tooltipText: { - color: theme.palette.background.default, - fontSize: theme.typography.fontSize, - lineHeight: 1.5, - }, - }), -); +export const useCostGrowthLegendStyles = makeStyles(theme => ({ + h5: { + ...theme.typography.h5, + fontWeight: 500, + padding: 0, + }, + marker: { + display: 'inherit', + marginRight: theme.spacing(1), + }, + helpIcon: { + display: 'inherit', + }, + title: { + ...theme.typography.overline, + fontWeight: 500, + lineHeight: 0, + marginRight: theme.spacing(1), + color: theme.palette.textSubtle, + }, + tooltip: { + display: 'block', + padding: theme.spacing(1), + backgroundColor: theme.palette.navigation.background, + }, + tooltipText: { + color: theme.palette.background.default, + fontSize: theme.typography.fontSize, + lineHeight: 1.5, + }, +})); export const useBarChartStepperStyles = makeStyles( (theme: BackstageTheme) =>