Skip to content

Issue on JSON.stringify (lib.es5.d.ts) #37641

@bwlt

Description

@bwlt

stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string;

stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string;

The signature of this functions are not correct. If passing undefined as an argument this function can return undefined.
On the above definitions the return type is always type string.

see mdn:

undefined, Functions, and Symbols are not valid JSON values. If any such values are encountered during conversion they are either omitted (when found in an object) or changed to null (when found in an array). JSON.stringify() can return undefined when passing in "pure" values like JSON.stringify(function(){}) or JSON.stringify(undefined).

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions