Skip to content

Commit c5b5be4

Browse files
JSON.stringify
1 parent ee75309 commit c5b5be4

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

lib/lib.es5.d.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ interface JSON {
307307
stringify<T>(
308308
value: T,
309309
replacer?: (this: unknown, key: string, value: unknown) => any,
310-
space?: string | number
310+
space?: string | number | null
311311
): T extends unknown
312312
? T extends
313313
| undefined
@@ -328,18 +328,39 @@ interface JSON {
328328
stringify(
329329
value: unknown,
330330
replacer?: (this: unknown, key: string, value: unknown) => any,
331-
space?: string | number
331+
space?: string | number | null
332332
): string | undefined;
333333
/**
334334
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
335335
* @param value A JavaScript value, usually an object or array, to be converted.
336-
* @param replacer An array of strings and numbers that acts as a approved list for selecting the object properties that will be stringified.
336+
* @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
337+
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
338+
*/
339+
stringify<T>(
340+
value: T,
341+
replacer?: (number | string)[] | null,
342+
space?: string | number | null
343+
): T extends unknown
344+
? T extends
345+
| undefined
346+
| ((...args: any) => any)
347+
| (new (...args: any) => any)
348+
| symbol
349+
? undefined
350+
: object extends T
351+
? string | undefined
352+
: string
353+
: never;
354+
/**
355+
* Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
356+
* @param value A JavaScript value, usually an object or array, to be converted.
357+
* @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
337358
* @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
338359
*/
339360
stringify(
340361
value: unknown,
341362
replacer?: (number | string)[] | null,
342-
space?: string | number
363+
space?: string | number | null
343364
): string | undefined;
344365
}
345366

0 commit comments

Comments
 (0)