Skip to content

Commit

Permalink
add casts
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Nov 23, 2020
1 parent d3b9a30 commit f1e41f7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/jest-config/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ export const _replaceRootDirTags = <T extends ReplaceRootDirConfigValues>(
case 'object':
if (Array.isArray(config)) {
/// can be string[] or {}[]
return config.map(item => _replaceRootDirTags(rootDir, item)) as T;
return (config as Array<string>).map(item =>
_replaceRootDirTags(rootDir, item),
) as T;
}
if (config instanceof RegExp) {
return config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default function deepCyclicCopyReplaceable<T>(
} else if (cycles.has(value)) {
return cycles.get(value);
} else if (Array.isArray(value)) {
return deepCyclicCopyArray(value, cycles);
return deepCyclicCopyArray(value as Array<T>, cycles);
} else if (isMap(value)) {
return deepCyclicCopyMap(value, cycles);
} else if (isBuiltInObject(value)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-util/src/deepCyclicCopy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function deepCyclicCopy<T>(
} else if (cycles.has(value)) {
return cycles.get(value);
} else if (Array.isArray(value)) {
return deepCyclicCopyArray(value, options, cycles);
return deepCyclicCopyArray(value as Array<any>, options, cycles);
} else {
return deepCyclicCopyObject(value, options, cycles);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-validate/src/condition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function getValues<T = unknown>(validOption: T): Array<T> {
// @ts-expect-error
validOption[MULTIPLE_VALID_OPTIONS_SYMBOL]
) {
return validOption;
return validOption as Array<T>;
}
return [validOption];
}
Expand Down

0 comments on commit f1e41f7

Please sign in to comment.