Skip to content

Commit cbfc964

Browse files
committed
chore: fix compile error
1 parent bc57655 commit cbfc964

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ type ModifyFields<T extends object> = {
3737
[K in keyof T]?: T[K] | ((oldValue: T[K], json: T) => T[K])
3838
//T[K] extends object ? ((oldValue: T[K]) => unknown)/* | GettersDeep<T[K]> */ : (oldValue: T[K]) => unknown
3939
};
40-
4140
type ModifyFunction<T> = (oldJson: T) => MaybePromise<T>;
41+
4242
// todo why can't use JsonValue from type-fest
4343
type JsonRoot = number | string | boolean | null | object | any[];
4444

@@ -95,11 +95,11 @@ export const modifyJsonFile: ModifyJsonFileGenericFunction = async (
9595
try {
9696
let { json, indent } = await loadJsonFile(path, { encoding, tabSize });
9797
if (typeof modifyFields === "function") {
98-
json = await modifyFields(json);
98+
json = await (modifyFields as any)(json);
9999
} else {
100100
if (typeof json !== "object" || Array.isArray(json)) throw new TypeError(`${path}: Root type is not object. Only callback can be used`);
101101
for (const parts of Object.entries(modifyFields)) {
102-
// todo fix typescript types workaround
102+
// todo fix typescript types
103103
const name = parts[0] as string;
104104
const value = parts[1] as any;
105105

0 commit comments

Comments
 (0)