Skip to content

Commit

Permalink
lib.d.ts: Include undefined in return type of JSON.stringify()
Browse files Browse the repository at this point in the history
JSON.stringify() may return undefined if the given input value is undefined or if the input value is not serializable (like `function(){}`).
See #18879
  • Loading branch information
Jonas Schürmann authored Oct 11, 2017
1 parent a7fa187 commit 04be41c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/es5.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -943,14 +943,14 @@ interface JSON {
* @param replacer A function that transforms the results.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string;
stringify(value: any, replacer?: (key: string, value: any) => any, space?: string | number): string | 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.
* @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
*/
stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;
stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string | undefined;
}

/**
Expand Down

0 comments on commit 04be41c

Please sign in to comment.