We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09bc2a5 commit 42e0e49Copy full SHA for 42e0e49
src/shared.ts
@@ -67,13 +67,15 @@ export function walkSet<T extends object = Record<any, unknown>>(
67
): T[any] | T[any][] {
68
// path can be a number
69
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 =>
+ // slipt produces at least one element
+ const key = keys.pop()!
+ const target: any = keys.reduce(
73
+ (target, key) =>
74
// TODO: dev errors
75
+ // @ts-expect-error:
76
target[key],
77
obj
- ) as Record<string | number, T> | T[]
78
+ )
79
80
return Array.isArray(target)
81
? target.splice(Number(key), 1, value)
0 commit comments