Skip to content

Commit 3bd5df6

Browse files
committed
refactor: use stronger typing (as linter suggests)
1 parent dd00698 commit 3bd5df6

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ export type Options = Partial<{
5353
removeJsonc: boolean
5454
}>
5555

56-
type ModifyProperties<T extends object> = {
56+
type ModifyProperties<T extends Record<string, any>> = {
5757
[K in keyof T]?: T[K] | ((oldValue: T[K], json: T) => T[K])
58-
//T[K] extends object ? ((oldValue: T[K]) => unknown)/* | GettersDeep<T[K]> */ : (oldValue: T[K]) => unknown
58+
//T[K] extends Record<string, any> ? ((oldValue: T[K]) => unknown)/* | GettersDeep<T[K]> */ : (oldValue: T[K]) => unknown
5959
}
6060
type ModifyFunction<T> = (oldJson: T) => MaybePromise<T>
6161

6262
// TODO remove duplicated definitions
6363

6464
export type ModifyJsonFileFunction<T extends JsonRoot, DefaultName extends boolean = false> = (
6565
path: DefaultName extends true ? string | { dir: string } : string,
66-
modifyProperties: T extends object ? ModifyProperties<T> | ModifyFunction<T> : ModifyFunction<T>,
66+
modifyProperties: T extends Record<string, any> ? ModifyProperties<T> | ModifyFunction<T> : ModifyFunction<T>,
6767
options?: Partial<Options>,
6868
) => Promise<void>
6969

70-
type ModifyJsonFileGenericFunction = <T extends JsonRoot = object>(
70+
type ModifyJsonFileGenericFunction = <T extends JsonRoot = Record<string, any>>(
7171
path: string,
72-
modifyProperties: T extends object ? ModifyProperties<T> | ModifyFunction<T> : ModifyFunction<T>,
72+
modifyProperties: T extends Record<string, any> ? ModifyProperties<T> | ModifyFunction<T> : ModifyFunction<T>,
7373
options?: Partial<Options>,
7474
) => Promise<void>
7575

0 commit comments

Comments
 (0)