File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff 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-
4140type ModifyFunction < T > = ( oldJson : T ) => MaybePromise < T > ;
41+
4242// todo why can't use JsonValue from type-fest
4343type 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
You can’t perform that action at this time.
0 commit comments