Skip to content

Return type of JSON.stringify() is string, but it can actually return undefined #225

@baker-ling

Description

@baker-ling

Typescript's out-of-the-box typing for JSON.stringify() has string as a return type.
Image

However, it actually returns undefined if the value being stringified is undefined.
Image

I think the return type should be "reset" to string | undefined. I'm curious what other people think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions