Skip to content

Commit

Permalink
chore: add typing for deepDiff library
Browse files Browse the repository at this point in the history
  • Loading branch information
sirtawast committed Mar 1, 2024
1 parent 605063e commit 98aec90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ const ReviewEditChanges: React.FC<ReviewEditChangesProps> = ({
const [changes, setChanges] = useState<Difference[]>([]);

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const diff: Difference[] =
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
deepDiff(initialValues, currentValues, (path: string[], key: string) =>
getDiffPrefilter(path, key, requiredKeys)
) || [];
Expand Down
15 changes: 15 additions & 0 deletions frontend/shared/src/types/deep-diff.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
declare module 'deep-diff' {
export type Difference = {
lhs: string | number;
rhs: string | number;
path: string[];
};

export function deepDiff(
lhs: Record<unknown, unknown>,
rhs: Record<unknown, unknown>,
prefilter?: (path: string[], key: string) => boolean
): Difference[];

export default deepDiff;
}

0 comments on commit 98aec90

Please sign in to comment.