Skip to content

Commit

Permalink
Add another overload to better handle undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
sstur committed Feb 20, 2023
1 parent 65d48c0 commit 38ef971
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/entrypoints/json-stringify.d.ts
@@ -1,4 +1,11 @@
interface JSON {
/**
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
* @param value A JavaScript value, usually an object or array, to be converted.
* @param replacer (Not Used)
* @param space (Not Used)
*/
stringify(value: undefined, replacer?: any, space?: any): undefined;
/**
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
* @param value A JavaScript value, usually an object or array, to be converted.
Expand Down
2 changes: 1 addition & 1 deletion src/tests/json-stringify.ts
Expand Up @@ -2,7 +2,7 @@ import { doNotExecute, Equal, Expect } from "./utils";

doNotExecute(() => {
const result = JSON.stringify(undefined);
type tests = [Expect<Equal<typeof result, string | undefined>>];
type tests = [Expect<Equal<typeof result, undefined>>];
});

doNotExecute(() => {
Expand Down

0 comments on commit 38ef971

Please sign in to comment.