From f1e41f7f4d1821286e95340c38476d9aad7cc601 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 23 Nov 2020 13:13:05 +0100 Subject: [PATCH] add casts --- packages/jest-config/src/utils.ts | 4 +++- packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts | 2 +- packages/jest-util/src/deepCyclicCopy.ts | 2 +- packages/jest-validate/src/condition.ts | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/jest-config/src/utils.ts b/packages/jest-config/src/utils.ts index b931c78f914f..875c77979c7d 100644 --- a/packages/jest-config/src/utils.ts +++ b/packages/jest-config/src/utils.ts @@ -101,7 +101,9 @@ export const _replaceRootDirTags = ( case 'object': if (Array.isArray(config)) { /// can be string[] or {}[] - return config.map(item => _replaceRootDirTags(rootDir, item)) as T; + return (config as Array).map(item => + _replaceRootDirTags(rootDir, item), + ) as T; } if (config instanceof RegExp) { return config; diff --git a/packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts b/packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts index 8928927b8d2d..756c255aa14f 100644 --- a/packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts +++ b/packages/jest-matcher-utils/src/deepCyclicCopyReplaceable.ts @@ -40,7 +40,7 @@ export default function deepCyclicCopyReplaceable( } else if (cycles.has(value)) { return cycles.get(value); } else if (Array.isArray(value)) { - return deepCyclicCopyArray(value, cycles); + return deepCyclicCopyArray(value as Array, cycles); } else if (isMap(value)) { return deepCyclicCopyMap(value, cycles); } else if (isBuiltInObject(value)) { diff --git a/packages/jest-util/src/deepCyclicCopy.ts b/packages/jest-util/src/deepCyclicCopy.ts index d9f59bc409bb..af9b967241e5 100644 --- a/packages/jest-util/src/deepCyclicCopy.ts +++ b/packages/jest-util/src/deepCyclicCopy.ts @@ -22,7 +22,7 @@ export default function deepCyclicCopy( } else if (cycles.has(value)) { return cycles.get(value); } else if (Array.isArray(value)) { - return deepCyclicCopyArray(value, options, cycles); + return deepCyclicCopyArray(value as Array, options, cycles); } else { return deepCyclicCopyObject(value, options, cycles); } diff --git a/packages/jest-validate/src/condition.ts b/packages/jest-validate/src/condition.ts index 8302f865f10d..1ec9fa6136c5 100644 --- a/packages/jest-validate/src/condition.ts +++ b/packages/jest-validate/src/condition.ts @@ -27,7 +27,7 @@ export function getValues(validOption: T): Array { // @ts-expect-error validOption[MULTIPLE_VALID_OPTIONS_SYMBOL] ) { - return validOption; + return validOption as Array; } return [validOption]; }