Skip to content

Commit c4c7c7c

Browse files
committed
Add example to stripTypename
1 parent 4955902 commit c4c7c7c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/utilities/common/stripTypename.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import { omitDeep } from "@apollo/client/utilities/internal";
55
*
66
* @param value - The object or array that should have `__typename` removed.
77
* @returns The object with all `__typename` properties removed.
8+
*
9+
* @example
10+
*
11+
* ```ts
12+
* stripTypename({
13+
* __typename: "User",
14+
* id: 1,
15+
* profile: { __typename: "Profile", name: "John Doe" },
16+
* });
17+
* // => { id: 1, profile: { name: "John Doe"}}
18+
* ```
819
*/
920
export function stripTypename<T>(value: T) {
1021
return omitDeep(value, "__typename");

0 commit comments

Comments
 (0)