Skip to content

Commit 42e0e49

Browse files
committed
refactor: types
1 parent 09bc2a5 commit 42e0e49

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/shared.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ export function walkSet<T extends object = Record<any, unknown>>(
6767
): T[any] | T[any][] {
6868
// path can be a number
6969
const keys = ('' + path).split('.') as Array<keyof T>
70-
const key = keys.pop() as string // split will produce at least one element array
71-
const target = keys.reduce(
72-
(target, key): any =>
70+
// slipt produces at least one element
71+
const key = keys.pop()!
72+
const target: any = keys.reduce(
73+
(target, key) =>
7374
// TODO: dev errors
75+
// @ts-expect-error:
7476
target[key],
7577
obj
76-
) as Record<string | number, T> | T[]
78+
)
7779

7880
return Array.isArray(target)
7981
? target.splice(Number(key), 1, value)

0 commit comments

Comments
 (0)