Skip to content

Commit 38ef971

Browse files
committed
Add another overload to better handle undefined
1 parent 65d48c0 commit 38ef971

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/entrypoints/json-stringify.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
interface JSON {
2+
/**
3+
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
4+
* @param value A JavaScript value, usually an object or array, to be converted.
5+
* @param replacer (Not Used)
6+
* @param space (Not Used)
7+
*/
8+
stringify(value: undefined, replacer?: any, space?: any): undefined;
29
/**
310
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
411
* @param value A JavaScript value, usually an object or array, to be converted.

src/tests/json-stringify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { doNotExecute, Equal, Expect } from "./utils";
22

33
doNotExecute(() => {
44
const result = JSON.stringify(undefined);
5-
type tests = [Expect<Equal<typeof result, string | undefined>>];
5+
type tests = [Expect<Equal<typeof result, undefined>>];
66
});
77

88
doNotExecute(() => {

0 commit comments

Comments
 (0)