Skip to content

Commit 9c80fc2

Browse files
committed
fix: type issues
1 parent e44555b commit 9c80fc2

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/core/compare.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -503,40 +503,40 @@ export const compare = (before: unknown, after: unknown, options: InternalCompar
503503
}
504504
}
505505

506+
export interface AggregateDiffsCrawlState {
507+
operationDiffs?: Set<Diff>
508+
}
509+
506510
export function aggregateDiffs(merged: unknown, options: InternalCompareOptions): unknown {
507511
let activeDataCycleGuard: Set<unknown> = new Set()
508512

509513
const collectCurrentNodeDiffs = (value: Record<string | symbol, unknown>, operationDiffs: Set<Diff>) => {
510514
if (options.metaKey in value) {
511515
const diffs = value[options.metaKey] as Record<PropertyKey, unknown> | undefined
512516
for (const key in diffs) {
513-
// @ts-ignore
514-
if (operationDiffs) {
515-
// @ts-ignore
516-
operationDiffs.add(diffs[key])
517-
}
517+
operationDiffs.add(diffs[key] as Diff)
518518
}
519519
}
520520
}
521521

522-
syncClone(
522+
syncClone<AggregateDiffsCrawlState>(
523523
merged,
524524
[
525525
({ key, value, state, rules }) => {
526526
if (!isObject(value)) {
527527
return { value }
528528
}
529529
if (typeof key === 'symbol') {
530-
// return { value }
531530
return { done: true }
532531
}
533532
if (activeDataCycleGuard.has(value)) {
534533
return { done: true }
535534
}
536535
activeDataCycleGuard.add(value)
537536

538-
// @ts-ignore
539-
collectCurrentNodeDiffs(value, state.operationDiffs)
537+
if (state.operationDiffs) {
538+
collectCurrentNodeDiffs(value, state.operationDiffs)
539+
}
540540

541541
if (rules && AGGREGATE_DIFFS_HERE_RULE in rules) {
542542
activeDataCycleGuard = new Set()
@@ -554,7 +554,8 @@ export function aggregateDiffs(merged: unknown, options: InternalCompareOptions)
554554
},
555555
],
556556
{
557-
rules: options.rules
557+
state: {},
558+
rules: options.rules,
558559
},
559560
)
560561

0 commit comments

Comments
 (0)