Skip to content

Commit

Permalink
Improve typings for 'toJSONDeep' function (#1995)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Jun 26, 2019
1 parent 2a0dcd9 commit 4899187
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/language/__tests__/toJSONDeep.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import isObjectLike from '../../jsutils/isObjectLike';
* Deeply transforms an arbitrary value to a JSON-safe value by calling toJSON
* on any nested value which defines it.
*/
export default function toJSONDeep<T>(value: T): T {
export default function toJSONDeep(value: mixed): mixed {
if (!isObjectLike(value)) {
return value;
}
Expand All @@ -20,7 +20,7 @@ export default function toJSONDeep<T>(value: T): T {
return value.map(toJSONDeep);
}

const result: any = {};
const result = Object.create(null);
for (const prop of Object.keys(value)) {
result[prop] = toJSONDeep(value[prop]);
}
Expand Down

0 comments on commit 4899187

Please sign in to comment.