Skip to content

Commit 4899187

Browse files
Improve typings for 'toJSONDeep' function (#1995)
1 parent 2a0dcd9 commit 4899187

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/language/__tests__/toJSONDeep.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import isObjectLike from '../../jsutils/isObjectLike';
66
* Deeply transforms an arbitrary value to a JSON-safe value by calling toJSON
77
* on any nested value which defines it.
88
*/
9-
export default function toJSONDeep<T>(value: T): T {
9+
export default function toJSONDeep(value: mixed): mixed {
1010
if (!isObjectLike(value)) {
1111
return value;
1212
}
@@ -20,7 +20,7 @@ export default function toJSONDeep<T>(value: T): T {
2020
return value.map(toJSONDeep);
2121
}
2222

23-
const result: any = {};
23+
const result = Object.create(null);
2424
for (const prop of Object.keys(value)) {
2525
result[prop] = toJSONDeep(value[prop]);
2626
}

0 commit comments

Comments
 (0)