Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

replaceEqualDeep.md

41 lines594 Bytes

1---
2id: replaceEqualDeep
3title: replaceEqualDeep
4---
5​
6```ts
7function replaceEqualDeep<T>(
8 a: unknown,
9 b: T,
10 depth?: number): T;
11```
12​
13Defined in: [packages/query-core/src/utils.ts:340](https://github.com/TanStack/query/blob/main/packages/query-core/src/utils.ts#L340)
14​
15This function returns `a` if `b` is deeply equal.
16If not, it will replace any deeply equal children of `b` with those of `a`.
17This can be used for structural sharing between JSON values for example.
18​
19## Type Parameters
20​
21### T
22​
23`T`
24​
25## Parameters
26​
27### a
28​
29`unknown`
30​
31### b
32​
33`T`
34​
35### depth?
36​
37`number`
38​
39## Returns
40​
41`T`